우분투를 라우터로 바꾸고 싶습니다. eth0 (192.168.0.0/24) 인터페이스와 eth1 (10.0.0.0/8) 인터페이스간에 트래픽을 라우팅하고 싶습니다.네트워크 인터페이스 간 경로 우분투
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
10.74.0.0 10.11.131.1 255.255.0.0 UG 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
고양이/proc 디렉토리/sys 인/그물 /의 IPv4/1
을 반환 IP_FORWARD :# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.8
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8 8.8.4.4
up route add -net 10.74.0.0/16 gateway 10.11.131.1 eth1
# ETH1
auto eth1
iface eth1 inet static
address 10.11.131.12
netmask 255.0.0.0
broadcast 10.255.255.255
gateway 10.11.131.1
dns-nameservers 8.8.8.8 8.8.4.4
up route add -net 8.8.0.0/16 gateway 192.168.0.1 eth0
up route add -net 10.74.0.0/16 gateway 10.11.131.1 eth1
경로 -n 나에게 다음과 같은 출력을 제공합니다 : 나는 다음은/etc/네트워크/인터페이스 구성이 나는 이리저리 모두 이더넷 인터페이스를 Ping 할 수 있습니다, 그러나
$ ping 192.168.0.8 -I eth1
PING 192.168.0.8 (192.168.0.8) from 10.11.131.12 eth1: 56(84) bytes of data.
From 10.11.131.12 icmp_seq=1 Destination Host Unreachable
$ ping 10.11.131.12 -I eth0
PING 10.11.131.12 (10.11.131.12) from 192.168.0.8 eth0: 56(84) bytes of data.
... no response ...
:
나는 eth1를하고 eth0를 사이에 Ping 할 수 m 루프백.
$ ping 10.11.131.12 -I lo
ping: Warning: source address might be selected on device other than lo.
PING 10.11.131.12 (10.11.131.12) from 192.168.0.8 lo: 56(84) bytes of data.
64 bytes from 10.11.131.12: icmp_seq=1 ttl=64 time=0.032 ms
$ ping 192.168.0.8 -I lo
ping: Warning: source address might be selected on device other than lo.
PING 192.168.0.8 (192.168.0.8) from 192.168.0.8 lo: 56(84) bytes of data.
64 bytes from 192.168.0.8: icmp_seq=1 ttl=64 time=0.032 ms
eth0에서 eth1로 ping 할 수 있고 그 반대의 경우 어떻게해야합니까?
내 목표는 우분투를 10.0.0.0/8과 192.168.0.0/24를 연결하는 라우터로 전환하는 것입니다. 궁극적으로는 NAT를 구성해야하지만 NAT를 설정하기 전에 인터페이스간에 ping을 수행 할 수 있어야합니다. – Ljung
그런 경우 구성이 작동해야합니다. 컴퓨터가 IP 포워딩으로 설정 되었기 때문에 패킷이 도착하면 기기가 경로를 지정하여 다른 인터페이스로 보내고 결국에는 나옵니다. 하지만 eth1에서 eth0로 ping을하면 패킷이 라우터를 통과하지 않고 대신 (IP 전달 모듈) 유선 연결이 해제됩니다. – Deepaklal
라우터로 작동합니다! 고맙습니다! – Ljung