[root@localhost ~]# rpm -qf `which ip`
iproute-2.6.32-32.el6_5.i686
[root@localhost ~]# rpm -ql iproute
/etc/iproute2
/etc/iproute2/ematch_map
/etc/iproute2/rt_dsfield
/etc/iproute2/rt_protos
/etc/iproute2/rt_realms
/etc/iproute2/rt_scopes
/etc/iproute2/rt_tables
/etc/sysconfig/cbq
/etc/sysconfig/cbq/avpkt
/etc/sysconfig/cbq/cbq-0000.example
/sbin/bridge
/sbin/cbq
/sbin/ifcfg
/sbin/ip
/sbin/rtmon
/sbin/tc
/usr/lib/tc
/usr/lib/tc/m_xt.so
/usr/sbin/arpd
/usr/sbin/lnstat
/usr/sbin/nstat
/usr/sbin/rtacct
/usr/sbin/ss
/usr/share/doc/iproute-2.6.32
/usr/share/doc/iproute-2.6.32/COPYING
/usr/share/doc/iproute-2.6.32/README
/usr/share/doc/iproute-2.6.32/README.decnet
/usr/share/doc/iproute-2.6.32/README.distribution
/usr/share/doc/iproute-2.6.32/README.iproute2+tc
/usr/share/doc/iproute-2.6.32/README.lnstat
/usr/share/man/man8/arpd.8.gz
/usr/share/man/man8/bridge.8.gz
/usr/share/man/man8/cbq.8.gz
/usr/share/man/man8/ifcfg.8.gz
/usr/share/man/man8/ip.8.gz
/usr/share/man/man8/lnstat.8.gz
/usr/share/man/man8/nstat.8.gz
/usr/share/man/man8/routel.8.gz
/usr/share/man/man8/rtacct.8.gz
/usr/share/man/man8/rtmon.8.gz
/usr/share/man/man8/ss.8.gz
/usr/share/man/man8/tc-bfifo.8.gz
/usr/share/man/man8/tc-cbq-details.8.gz
/usr/share/man/man8/tc-cbq.8.gz
/usr/share/man/man8/tc-htb.8.gz
/usr/share/man/man8/tc-pfifo.8.gz
/usr/share/man/man8/tc-pfifo_fast.8.gz
/usr/share/man/man8/tc-prio.8.gz
/usr/share/man/man8/tc-red.8.gz
/usr/share/man/man8/tc-sfq.8.gz
/usr/share/man/man8/tc-tbf.8.gz
/usr/share/man/man8/tc.8.gz
/usr/share/tc
/usr/share/tc/normal.dist
/usr/share/tc/pareto.dist
/usr/share/tc/paretonormal.dist
[root@CentOS7 ~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
[root@CentOS7 ~]# ip link show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
[root@CentOS7 ~]# ip link set dev lo down
[root@CentOS7 ~]# ip lin show lo
1: lo: <LOOPBACK> mtu 65536 qdisc noqueue state DOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[root@CentOS7 ~]# ip link set dev lo up
[root@CentOS7 ~]# ip lin show lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
[root@CentOS7 ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1018sec preferred_lft 1018sec
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr add 10.201.106.119 dev ens33
[root@CentOS7 ~]#
[root@CentOS7 ~]#
[root@CentOS7 ~]# ip addr show dev ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1654sec preferred_lft 1654sec
inet 10.201.106.119/32 scope global ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr delete 10.201.106.119/32 dev ens33
[root@CentOS7 ~]# ip addr show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1372sec preferred_lft 1372sec
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr add 10.201.106.222/24 dev ens33 label ‘ens33:1‘
[root@CentOS7 ~]# ip add show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1151sec preferred_lft 1151sec
inet 10.201.106.222/24 scope global secondary ens33:1 #显示label
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr del 10.201.106.222/24 dev ens33 label ens33:1
[root@CentOS7 ~]# ip addr show ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1482sec preferred_lft 1482sec
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr show dev ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1183sec preferred_lft 1183sec
inet 10.201.106.222/24 scope global secondary ens33:3
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]#
[root@CentOS7 ~]#
[root@CentOS7 ~]# ip addr show dev ens33 primary
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1181sec preferred_lft 1181sec
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]#
[root@CentOS7 ~]# ip addr show dev ens33 secondary
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.222/24 scope global secondary ens33:3
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip addr flush dev ens33 label ens33:3
[root@CentOS7 ~]# ip addr show dev ens33
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:a7:7a:ec brd ff:ff:ff:ff:ff:ff
inet 10.201.106.130/24 brd 10.201.106.255 scope global dynamic ens33
valid_lft 1718sec preferred_lft 1718sec
inet6 fe80::20c:29ff:fea7:7aec/64 scope link
valid_lft forever preferred_lft forever
[root@CentOS7 ~]# ip route add 192.168.1.3/32 via 10.201.106.2 dev ens33
[root@CentOS7 ~]# ip route show
default via 10.201.106.2 dev ens33 proto static metric 100
10.201.106.0/24 dev ens33 proto kernel scope link src 10.201.106.130 metric 100
192.168.1.3 via 10.201.106.2 dev ens33
[root@CentOS7 ~]# ip route add 192.168.0.0/24 via 10.201.106.2 dev ens33
[root@CentOS7 ~]# ip route show dev ens33
default via 10.201.106.2 proto static metric 100
10.201.106.0/24 proto kernel scope link src 10.201.106.130 metric 100
192.168.0.0/24 via 10.201.106.2
192.168.1.3 via 10.201.106.2
[root@CentOS7 ~]# ip route del 192.168.1.3
[root@CentOS7 ~]# ip route list
default via 10.201.106.2 dev ens33 proto static metric 100
10.201.106.0/24 dev ens33 proto kernel scope link src 10.201.106.130 metric 100
192.168.0.0/24 via 10.201.106.2 dev ens33
[root@CentOS7 ~]# ip route del 192.168.0.0/24
[root@CentOS7 ~]# ip route list
default via 10.201.106.2 dev ens33 proto static metric 100
10.201.106.0/24 dev ens33 proto kernel scope link src 10.201.106.130 metric 100
[root@CentOS7 ~]# ip route add default via 10.201.106.102
[root@CentOS7 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.201.106.102 0.0.0.0 UG 0 0 0 ens33
0.0.0.0 10.201.106.2 0.0.0.0 UG 100 0 0 ens33
10.201.106.0 0.0.0.0 255.255.255.0 U 100 0 0 ens33
ip route flush
[root@CentOS7 ~]# ss -tan
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
ESTAB 0 0 10.201.106.130:22 10.201.106.1:49530
ESTAB 0 0 10.201.106.130:22 10.201.106.1:49506
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
[root@CentOS7 ~]# ss -tan state ESTABLISHED
Recv-Q Send-Q Local Address:Port Peer Address:Port
0 52 10.201.106.130:22 10.201.106.1:49530
0 0 10.201.106.130:22 10.201.106.1:49506
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
# If you‘re having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
ONBOOT="yes"
TYPE="Ethernet"
NM_CONTROLLED="yes"
BOOTPROTO="static"
IPADDR=10.201.106.250
NETMASK=255.255.255.0
GATEWAY=10.201.106.2
[root@zabbix network-scripts]# vim route-eth0
192.168.0.0/24 via 10.201.106.2
[root@zabbix network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.201.106.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 10.201.106.2 255.255.255.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.201.106.2 0.0.0.0 UG 0 0 0 eth0
[root@zz network-scripts]# vim route-eth0
ADDRESS0=192.168.20.0
NETMASK0=255.255.255.0
GATEWAY0=10.201.106.2
ADDRESS1=192.168.30.0
NETMASK1=255.255.255.0
GATEWAY1=10.201.106.2
[root@zz network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
ipcalc: bad IPv4 address: 192.168.3330.0
Error: an inet prefix is expected rather than "192.168.3330.0/24".
[ OK ]
[root@zz network-scripts]# vim route-eth0
[root@zz network-scripts]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[ OK ]
[root@zz network-scripts]#
[root@zz network-scripts]#
[root@zz network-scripts]#
[root@zz network-scripts]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.20.0 10.201.106.2 255.255.255.0 UG 0 0 0 eth0
10.201.106.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.30.0 10.201.106.2 255.255.255.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
0.0.0.0 10.201.106.2 0.0.0.0 UG 0 0 0 eth0
[root@zz network-scripts]# ifconfig eth0:1 192.168.0.22/24 up
[root@zz network-scripts]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:4E:AF:24
inet addr:10.201.106.128 Bcast:10.201.106.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe4e:af24/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2221 errors:0 dropped:0 overruns:0 frame:0
TX packets:1851 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:204895 (200.0 KiB) TX bytes:278337 (271.8 KiB)
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:4E:AF:24
inet addr:192.168.0.22 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@zz network-scripts]#
[root@zz network-scripts]# ping 192.168.0.22
PING 192.168.0.22 (192.168.0.22) 56(84) bytes of data.
64 bytes from 192.168.0.22: icmp_seq=1 ttl=64 time=1.05 ms
64 bytes from 192.168.0.22: icmp_seq=2 ttl=64 time=0.339 ms
cp ifcfg-eth0 ifcfg-eth0:1
[root@zz network-scripts]# vim ifcfg-eth0:1
DEVICE=eth0:1
HWADDR=00:0C:29:4E:AF:24
TYPE=Ethernet
UUID=a493b909-229d-4a02-b1b5-ebbb51d16983
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO="static"
IPADDR=192.168.0.22
NETMASK=255.255.255.0
DNS1=10.201.106.2
[root@zz network-scripts]# vim /etc/sysconfig/network
NETWORKING=yes #网络总开关,网络不通先确认该项有没打开
HOSTNAME=zabbix.localdomain
[root@zz ~]# cd /etc/udev/rules.d/
vim 70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4e:af:24", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1 #改为eth1
[root@zz rules.d]# lsmod #查看网卡
[root@zz rules.d]# modprobe -r e1000 #卸载网卡
[root@zz rules.d]# modprobe e1000 #加载网卡
[root@zz ~]# service network restart #重启网络服务
[root@zz ~]# ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:0C:29:4E:AF:24
inet addr:10.201.106.128 Bcast:10.201.106.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe4e:af24/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:350 errors:0 dropped:0 overruns:0 frame:0
TX packets:305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34875 (34.0 KiB) TX bytes:65070 (63.5 KiB)
原文地址:http://blog.51cto.com/zhongle21/2091353