标签:route-eth0
方法1:echo "192.168.1.0/24 via 172.17.100.1" > /etc/sysconfig/network-scripts/route-eth0
[root@cms ~]# echo "192.168.1.0/24 via 172.17.100.1" > /etc/sysconfig/network-scripts/route-eth0 [root@cms ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 172.17.100.1 255.255.255.0 UG 0 0 0 eth0 172.17.100.0 0.0.0.0 255.255.255.0 U 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 172.17.100.1 0.0.0.0 UG 0 0 0 eth0 [root@cms ~]#
方法2:
[root@cms ~]# echo -e "ADDRESS0=192.168.1.0\nNETMASK0=255.255.255.0\nGATEWAY0=172.17.100.1" > /etc/sysconfig/network-scripts/route-eth0 [root@cms ~]# cat /etc/sysconfig/network-scripts/route-eth0 ADDRESS0=192.168.1.0 NETMASK0=255.255.255.0 GATEWAY0=172.17.100.1 [root@cms ~]# /etc/init.d/network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining if ip address 172.17.100.240 is already in use for device eth0... [ OK ] [root@cms ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 172.17.100.1 255.255.255.0 UG 0 0 0 eth0 172.17.100.0 0.0.0.0 255.255.255.0 U 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 172.17.100.1 0.0.0.0 UG 0 0 0 eth0 [root@cms ~]#
本文出自 “HeZhang” 博客,请务必保留此出处http://hezhang.blog.51cto.com/1347601/1633122
标签:route-eth0
原文地址:http://hezhang.blog.51cto.com/1347601/1633122