[root@szm ~]# route add -net 192.168.5.0 netmask 255.255.255.0 gw 192.168.179.2 [root@szm ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.179.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0 192.168.5.0 192.168.179.2 255.255.255.0 UG 0 0 0 eth0 172.16.128.0 0.0.0.0 255.255.255.0 U 1 0 0 eth1 0.0.0.0 192.168.179.2 0.0.0.0 UG 0 0 0 eth0
快速建立测试用IP:
永久建立多IP地址方法一: #!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local 永久建立多IP地址方法二:(注意NetworkManager的影响)
设置路由: [root@szm ~]# cat /etc/sysconfig/network-scripts/route-eth0 192.168.100.0/24 via 192.168.179.1 dev eth0 二:宣告路由
[root@szm ~]# cat /etc/quagga/ripd.conf hostname szm.test.com password linux debug rip events debug rip packet router rip version 2 network 192.168.179.0/24 network 192.168.100.0/24 interface eth0 no ip rip authentication mode log file /var/log/quagga/zebra.log
[root@szm ~]# /etc/init.d/ripd start Starting ripd: [ OK ]
[root@szm ~]# netstat -tulnp | grep ripd tcp 0 0 127.0.0.1:2602 0.0.0.0:* LISTEN 23477/ripd udp 0 0 0.0.0.0:520 0.0.0.0:* 23477/ripd 代理ARP: pc1-----------------外(eth0)R1(eth1)内------------pc2,pc3,pc4 eth0:00:00:00:00:00:00 绑定内部MAC到外部接口:
[root@szm ~]# ifconfig eth0:0 192.168.0.100 netmask 255.255.255.0 up
当要启动eth0:0时,eth0必须要启动才行。而当eth0被关闭后,所有eth0:n的模拟网卡也将同时关闭。
[root@szm ~]# cat /etc/rc.d/rc.local
[root@szm ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1:0
Centos 6.X默认的防火墙会将来自不同网卡的沟通数据包删除。
ripd这个服务可以在两台Router之间进行路由规则的交换与沟通。Centos的Quagga所提供的Ripd服务使用的是V2版本,这个版本默认要求身份验证的操作,但是对于小型网络如果并不想加入这个身份验证的有,那就需要增加某些设置值才能够顺利启动Ripd。
eth1:11:11:11:11:11:11
[root@szm ~]# arp -i eth0 -s 192.168.11.2 00:00:00:00:00:00 pub
[root@szm ~]# arp -i eth0 -s 192.168.11.3 00:00:00:00:00:00 pub
[root@szm ~]# arp -i eth0 -s 192.168.11.4 00:00:00:00:00:00 pub
[root@szm ~]# route add -host 192.168.11.2 eth1
欺骗内部主机MAC: