网口配置好相关信息后,还需要开启IP路由转发传递;
[root@server ~]# echo "1" > /proc/sys/net/ipv4/ip_forward
也可以直接编辑/etc/sysctl.conf文件
将# Controls IP packet forwarding
net.ipv4.ip_forward = 0改成1即可
然后重启网络,并观察路由表;
[root@server ~]# /etc/init.d/network restart
Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0 [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]
[root@server ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
基本配置完成,开始测试客户端是否能通LINUX ROUTE上网;
由于LINUX的安全性,关闭LINUX IPTABLES 即可解决;
[root@server ~]# service iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]