我已经正确设置网卡参数,两个IP都已经可以正常ping通了。
目前遇到的问题:
我想实现:
其他人从Ipa访问服务器时,服务器返回使用Ipa为地址
而从Ipb访问服务器时,服务器返回使用Ipb为地址
通俗点说:
从IPA curl cip.cc得到的结果为IPA
从IPB curl cip.cc得到的结果为IPB
目前状况:
我已经实践了很长时间(例如卸载firewall防火墙使用ipbatles设置转发规则),但结果是无论他人访问的是Ipa或者Ipb,返回地址总是Ipa(main ip)
以下是我的网卡配置
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=ipa
NETMASK=255.255.254.0
GATEWAY=149.28.128.1
DNS1=108.61.10.10
IPV6INIT=yes
IPV6ADDR="2001:19f0:4400:72fb:5400:04ff:fe18:9b64/64"
IPV6_AUTOCONF="yes"
DNS2=2001:19f0:300:1704::6
the /etc/sysconfig/network-scripts/route-eth0
169.254.0.0/16 dev eth0
the /etc/sysconfig/network-scripts/ifcfg-eth0:1
DEVICE=eth0:1
BOOTPROTO=static
IPADDR=ipb
NETMASK=255.255.255.255
ONBOOT=yes
以下为路由表
IDestination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 0 0 0 eth0
IPA 0.0.0.0 255.255.254.0 U 0 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 0 0 0 eth0
link-local 0.0.0.0 255.255.0.0 U 1002 0 0 eth0
问题一直没有解决。恳请了解的兄弟朋友帮忙,祝您工作顺利,生活愉快!