Đặt 2 range IP khác nhautrên 2 card mạng Centos 7
Trường hợp bạn muốn chạy 2 range ip khác nhau trên 2 card mạng thì bạn làm như sau:
ip route add 192.168.251.0/24 dev enp6s0f0 tab 1
ip route add 192.168.118.0/24 dev enp6s0f1 tab 2
ip route add default via 192.168.251.1 dev enp6s0f0 tab 1
ip route add default via 192.168.118.1 dev enp6s0f1 tab 2
ip route flush cache
Nếu muốn reboot lại mà dẫn lưu và chạy thì bạn tạo thêm 2 file sau:
vi /etc/sysconfig/network-scripts/route-enp6s0f0
192.168.251.0/24 dev enp6s0f0 tab 1
default via 192.168.251.1 dev enp6s0f0 tab 1
vi /etc/sysconfig/network-scripts/route-enp6s0f1
192.168.118.0/24 dev enp6s0f1 tab 2
default via 192.168.118.1 dev enp6s0f1 tab 2
định nghĩa:
nano /etc/iproute2/rt_tables
Tham khảo:
http://jensd.be/468/linux/two-network-cards-rp_filter
và
https://serverspace.io/support/help/...aces-centos-7/