
主机评测
IP地址信息如下:
电信IP:192.168.0.2
子网掩码:255.255.255.0
网关:192.168.0.1
联通IP:10.0.0.2
子网掩码:255.255.255.0
网关:10.0.0.1
移动IP:172.16.0.2
子网掩码:255.255.255.0
网关:172.16.0.1
配置网卡:
root@locahost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
- DEVICE=eth0
- HWADDR=00:26:6C:F0:24:74
- TYPE=Ethernet
- UUID=701696b6-b01b-45aa-bfdd-aca1563e6072
- ONBOOT=yes
- NM_CONTROLLED=yes
- BOOTPROTO=static
- IPADDR=192.168.0.2
- NETMASK=255.255.255.0
- GATEWAY=192.168.0.1
-
- IPADDR2=10.0.0.2
- NETMASK2=255.255.255.0
-
- IPADDR3=172.16.0.2
- NETMASK3=255.255.255.0
配置路由表名称
root@locahost ~]# vi /etc/iproute2/rt_tables
- #
- # reserved values
- #
- 255 local
- 254 main
- 253 default
- 252 tel
- 251 cnc
- 250 cmc
- 0unspec
- #
- # local
- #
- #1inr.ruhep
配置策略路由条目
root@locahost ~]# vi /etc/rc.d/init.d/network
在文件内容倒数第二行插入以下内容
- ip route flush table tel
- ip route add default via 192.168.0.1 dev eth0 src 192.168.0.2 table tel
- ip rule add from 192.168.0.2 table tel
-
- ip route flush table cnc
- ip route add default via 10.0.0.1 dev eth0 src 10.0.0.2 table cnc
- ip rule add from 10.0.0.2 table cnc
-
- ip route flush table cmc
- ip route add default via 172.16.0.1 dev eth0 src 172.16.0.2 table cmc
- ip rule add from 172.16.0.2 table cmc
重启网卡
root@locahost ~]# service network restart