ip addr show 查看当前网络地址
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_12970720429BRR.png"></a>
ip link show 查看网络链接状态
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072043GVQv.png"></a>
ip -s link show 查看网卡统计信息
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072044e0sY.png"></a>
ip addr add 192.168.0.154 添加ip地址
ip link dev eth0 down 禁用ip地址
网卡的配置文件/etc/sysconfig/network-scripts/ifcfg-ethx
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_12970720457y7o.png"></a>
自动专用地址:169.254.*.* 仅用于实现本网段内的通信,不能路由
给网卡取一个别名
ipconfig eth0:0 172.16.0.1/16
cat /etc/sysconfig/network-scripts/ifcfg-eth1-range0
DEVICE=eth2
IPADDR_START=192.168.53.1
IPADDR_END=192.168.53.30
NETMASK=255.255.255.0
CLONENUM_START="1"
添加路由:
route -n 查看当前路由表
netstat -r n 查看当前路由表
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072046dhVl.png"></a>
ip route 查看当前路由表
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072047TdNo.png"></a>
手动添加静态路由
route add -host (到目标主机的路由) TARGET/mask gw
-net (到目标网络的路由)
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072048LdiC.png"></a>
添加一条到达主机的路由
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072050dwMv.png"></a>
确保路由条目永久生效,在/etc/sysconfig/network-scripts/手动编辑配置文件
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072051hSoM.png"></a>
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072052vMDY.png"></a>
Hostname
改变当前主机名:hostname linna.com
sysctl -w kernel.com
echo "linna.com" &gt; /proc/sys/kernel/hostname
永久生效:修改/etc/sysconfig/network文件
HOSTNAME=linna.com
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072052w6Ir.png"></a>
修改/etc/hosts设置主机别名
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072053o2Kj.png"></a>
netstat -t 查看所有tcp连接
-u 查看所有udp连接
-r 查看路由信息
-n 以数字方式显示,不显示主机名称
-l 显示所有正在侦听的地址
-p 由哪个进程正在监听
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072054r3WA.png"></a>
nmap 扫描在线主机,强大的探测工具
<a href="http://lyp0909.blog.51cto.com/attachment/201102/7/508999_1297072055Urp8.png"></a>
tcpdump -i eth0 抓包工具
wireshark 协议分析软件
netcat 黑客工具
Ethernet Channel Bonding
加载模块: modprobe bonding
/etc/sysconfig/network-scripts/
ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.0.2
GATEWAY=192.168.0.1
NETMASK=255.255.255.0
BONDING_IPTS="mode=1 miimon=50" // mode= 0 轮询 (负载均衡)1 热备
BOOTPROTO=static
ifcfg-eth0 ifcfg-eth1
DEVICE=eth0 DEVICE=eth1
MASTER=bond0 MASTER=bond0
SLAVE=yes SLAVE=yes
ONBOOT=yes ONBOOT=yes
本文转自 490999122 51CTO博客,原文链接:http://blog.51cto.com/lyp0909/489276,如需转载请自行联系原作者