Linux server bind multiple network adapters IP

Requirements: Binding two public IP on Taiwan Linux, to achieve extended IP for dedicated service
Question: Adding a binding one Elastic IP on a network card, network adapter binding primary public network ip be a normal visit, but the expansion card can not access the public network ip.
The reason: not set routing rules, leading the newly added IP extension card can not access
 
1: Adding a route table alias test
[root@test ~]# vim /etc/iproute2/rt_tables
#
# reserved values
#
255     local
254     main
253     default
0       unspec
32000  test
#
# local
#
# 1 inr.ruhep
 
## Add 32000 test, then save and exit!
 
2: Add a routing table in test
[root@test ~]# ip route add default via 172.16.0.1 dev eth1 table test
 
## 172.16.0.1 (expansion card gateway ip), test (add test table)
 
 
3: Add Policy Routing
[root@test ~]# ip rule add from 172.16.0.13 lookup test prio 32000
 
## 172.16.0.13 (expansion card private network IP)
 
4: Can I access via Telnet + IP test
[c:\~]$ telnet 139.159.236.94 22
 
 
Connecting to 139.159.236.91:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
SSH-2.0-OpenSSH_7.4
Connection closing...Socket close

Guess you like

Origin www.cnblogs.com/douyi/p/11583770.html