我在专用网络中有2台服务器,其中一台具有公共ip:
“ lb”具有2个带有1个公共ip和1个私有ip的接口(ens3 51.83.14.172和ens4 192.168.0.1)
“ node01”具有1个私有ip(ens1 192.168.0.12)
我想将节点1的传出流量路由“ lb”
node01 ens4 =>磅ens4 =>磅ens 3 =>互联网
这是我的配置,但是我可以从node01 ping Internet
服务器磅
ifconfig
ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 51.83.14.172 netmask 255.255.255.255 broadcast 0.0.0.0
inet6 fe80::f816:3eff:fe50:df72 prefixlen 64 scopeid 0x20<link>
ether fa:16:3e:50:df:72 txqueuelen 1000 (Ethernet)
RX packets 164514 bytes 19045889 (19.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 149861 bytes 10579204 (10.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::f816:3eff:fe18:e04 prefixlen 64 scopeid 0x20<link>
ether fa:16:3e:18:0e:04 txqueuelen 1000 (Ethernet)
RX packets 2947 bytes 411124 (411.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3766 bytes 269126 (269.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 533 bytes 63226 (63.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 533 bytes 63226 (63.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
/etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
ens3:
dhcp4: true
ens4:
addresses: [192.168.0.1/24]
nameservers:
addresses: [8.8.8.8,8.8.4.4]
dhcp4: no
服务器node01
ifconfig
ens4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.12 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::f816:3eff:fea4:3df7 prefixlen 64 scopeid 0x20<link>
ether fa:16:3e:a4:3d:f7 txqueuelen 1000 (Ethernet)
RX packets 3588 bytes 283573 (283.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1628 bytes 282583 (282.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 522 bytes 41957 (41.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 522 bytes 41957 (41.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
/etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
ens4:
addresses: [192.168.0.12/24]
nameservers:
addresses: [8.8.8.8]
dhcp4: no
gateway4: 192.168.0.1