
여러 게이트웨이로 구성하고 싶은 이더넷 포트가 2개 있는 서버가 있습니다.
포트 1을 기본 게이트웨이로 설정하고 포트 2에서 들어오는 트래픽이 포트 2로 나가도록 하고 싶습니다.
이 작업을 수행하는 방법에 대한 많은 가이드를 따랐지만 작동하게 만들 수는 없습니다.
인터페이스 파일에 사용하고 있는 스크립트는 다음과 같습니다.
# The primary network interface
allow-hotplug eno2
iface eno2 inet dhcp
gateway 192.168.3.1
post-up ip route add 192.168.3.0/24 dev eno2 table ethvpn
post-up ip route add default via 192.168.3.1 dev eno2 table ethvpn
post-up ip rule add from 192.168.3.101/102 table ethvpn
post-up ip rule add to 192.168.3.101/102 table ethvpn
# Secondary network interface
allow-hotplug eno3
iface eno3 inet dhcp
post-up ip route add 192.168.0.0/24 dev eno3 table ethwan
post-up ip route add default via 192.168.0.1 dev eno3 table ethwan
post-up ip rule add from 192.168.0.101/102 table ethwan
post-up ip rule add to 192.168.0.101/102 table ethwan
ip rule show를 입력하면 내 테이블(ethwan, ethvpn)이 표시되지 않습니다. 이 명령을 수동으로 입력하려고 하면: ip rule add from 192.168.3.101/102 table ethwan 오류가 발생합니다.
Error: inet prefix is expected rather than "192.168.3.101/102".
예약된 IP를 사용하여 DHCP를 사용할 때 이 작업을 수행할 수 있습니까? 이 작업을 어떻게 수행할 수 있나요?
답변1
192.168.0.101/102는 유효한 서브넷이 아닙니다. / 뒤의 숫자는 서브넷 마스크의 비트 수입니다. 규칙에 101 및 102를 적용하려는 경우. 192.168.101/32 및 192.168.0.102/32에 대해 2개의 별도 규칙을 수행합니다.