![두 개의 서로 다른 게이트웨이를 사용한 라우팅](https://linux55.com/image/141917/%EB%91%90%20%EA%B0%9C%EC%9D%98%20%EC%84%9C%EB%A1%9C%20%EB%8B%A4%EB%A5%B8%20%EA%B2%8C%EC%9D%B4%ED%8A%B8%EC%9B%A8%EC%9D%B4%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%9C%20%EB%9D%BC%EC%9A%B0%ED%8C%85.png)
다음 질문이 있습니다. 8.8.4.4 핑을 할 수 없습니다
ping -I ens192 8.8.4.4
PING 8.8.4.4 (8.8.4.4) from 192.168.4.44 ens192: 56(84) bytes of data.
^C
--- 8.8.4.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1023ms
ping -I ens192:1 8.8.4.4
ping: invalid source address ens192:1
내 네트워크는 1개의 네트워크 인터페이스와 두 번째 가상 인터페이스로 구성됩니다. 게이트웨이도 2개 있습니다. 두 게이트웨이를 모두 구성해야 합니다.
이전에 확인했는데 Debian의 일반 게이트웨이 회선을 통해 Google 서버에 연결할 수 있습니다. 두 게이트웨이 모두에서. 그러면 어떻게 작동하게 만들 수 있나요?
내 인터페이스 구성 파일
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens192
allow-hotplug ens192
iface ens192 inet static
address 192.168.4.44
netmask 255.255.255.0
post-up ip route add 192.168.4.0/24 dev ens192 src 192.168.4.44 table rt1
post-up ip route add default via 192.168.4.1 dev ens192 table rt1
post-up ip rule add from 192.168.4.44/32 table rt1
post-up ip rule add to 192.168.4.44/32 table rt1
auto ens192:1
allow-hotplug ens192:1
iface ens192:1 inet static
address 192.168.4.201
netmask 255.255.255.0
post-up ip route add 192.168.4.0/24 dev ens192:1 src 192.168.4.201 table rt2
post-up ip route add default via 192.168.4.3 dev ens192 table rt2
post-up ip rule add from 192.168.4.201/32 table rt2
post-up ip rule add to 192.168.4.201/32 table rt2
답변1
몇 가지:
- 인터페이스의 IP 주소를 전달합니다
-I
. 즉-I 192.168.4.201
- 두 번째 인터페이스의 기본 경로는
dev ens192
다음과 같습니다.dev ens192:1
- 나는 당신이 192.168.4.1과 192.168.4.3을 핑할 수 없거나 여기에 표시되지 않은 다른 구성이 있다고 추측합니다.