COLO.in.th > คลังความรู้ > CentOS 6 > Split Route two IP Address
ในส่วนนี้ทางผมได้ trunk vlan เข้ามา และทำการ tagged vlan
โดยมีการกำหนดรายละเอียดดังนี้
Switch Cisco Configinterface GigabitEthernet1/0/1
switchport trunk allowed vlan 101,102,103
switchport mode trunk
spanning-tree portfast
Vlan ID 101 - IP 192.168.10.10/24, Gw 192.168.10.1
Vlan ID 102 - IP 192.168.20.20/24, Gw 192.168.20.1
Vlan ID 103 - IP 192.168.30.30/24, Gw 192.168.30.1
#cat /etc/sysconfig/network-scripts/ifcfg-eth0DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
#cat /etc/sysconfig/network-scripts/ifcfg-eth0.101DEVICE=eth0.101
BOOTPROTO=none
IPADDR=192.168.10.10
NETMASK=255.255.255.0
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
VLAN=yes
#cat /etc/sysconfig/network-scripts/ifcfg-eth0.102DEVICE=eth0.102
BOOTPROTO=none
IPADDR=192.168.20.20
NETMASK=255.255.255.0
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
VLAN=yes
#cat /etc/sysconfig/network-scripts/ifcfg-eth0.103DEVICE=eth0.103
BOOTPROTO=none
IPADDR=192.168.30.30
NETMASK=255.255.255.0
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
VLAN=yes
Config route tableip route add default via 192.168.10.1 dev eth0.101 table 1
ip route add default via 192.168.20.1 dev eth0.102 table 2
ip route add default via 192.168.30.1 dev eth0.103 table 3
ip rule add from 192.168.10.10 tab 1 priority 500
ip rule add from 192.168.20.20 tab 2 priority 501
ip rule add from 192.168.20.30 tab 3 priority 502
Add auto route table on rebootedcd /etc/sysconfig/network-scripts/
echo 'default via 192.168.10.1 dev eth0.101 table 1' > route-eth0.101
echo 'default via 192.168.20.1 dev eth0.102 table 2' > route-eth0.102
echo 'default via 192.168.30.1 dev eth0.103 table 3' > route-eth0.103
echo 'from 192.168.10.10 tab 1 priority 500' > rule-eth0.101
echo 'from 192.168.20.20 tab 2 priority 501' > rule-eth0.102
echo 'from 192.168.30.30 tab 3 priority 502' > rule-eth0.103
Config default routeip route add default via 192.168.10.1
ลบ default routeip route del default
netstat -anr
ip route show
บันทึกสู่รายการโปรดของฉัน พิมพ์หัวข้อนี้
Powered by WHMCompleteSolution