
구성 중입니다.내부 네트워크Virtual Box와 4개의 Virtual Machine을 사용합니다. 모든 인터페이스를 구성하고 약간의 작업을 수행했습니다.IP 포워딩그리고IP 매스커레이드호스트에서라우터.
라우터에는두 개의 이더넷 인터페이스: 하나는 HostC에 연결되고 다른 하나는 HostA 및 HostB에 연결됩니다.
만약 내가 무엇을 잘못했나요?호스트C핑을 보낼 수 있습니다호스트 A와 B하지만호스트 A와 B핑을 보낼 수 없습니다호스트C. 라우터 구성이어야 합니다.
답변1
여기서 문제를 진단하려면 게시물에 더 많은 정보를 추가해야 합니다. 이를 진단하기 위한 몇 가지 명령이 있고 댓글에서 읽기 어려울 수 있으므로 명확성을 위한 답변으로 이것을 추가하고 있습니다. 라우터에서 다음 명령을 실행하고 출력을 보고하면 네트워크 설정 및 구성을 이해하고 문제를 식별하는 데 도움이 됩니다.
인터페이스 목록:
ip link show
인터페이스 전달 상태 나열:
sysctl -a | grep forwarding
인터페이스 주소 나열:
ip addr show
ip -6 addr show
방화벽 규칙 나열:
iptables -L
ip6tables -L
NAT 규칙을 나열합니다.
iptables -t nat -L
ip6tables -t nat -L
또한 라우터 자체가 모든 호스트에 연결할 수 있는지 확인하세요.
ping -c4 HostA
ping -c4 HostB
ping -c4 HostC
물론 HostA/B/C를 호스트 IP 주소로 바꾸는 것은 중요한 단계입니다. 여기에 문제가 있는 경우 서브넷 간 라우팅에 대해 걱정하기 전에 먼저 해결해야 하기 때문입니다.
답변2
ip link show
결과:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:90:2d:e5 brd ff:ff:ff:ff:ff:ff 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 08:00:27:d4:ac:c1 brd ff:ff:ff:ff:ff:ff
모든 것이 괜찮아 보입니다.
sysctl -a |grep forwarding
결과:
net.ipv4.conf.all.forwarding = 1 net.ipv4.conf.all.mc_forwarding = 0 net.ipv4.conf.default.forwarding = 1 net.ipv4.conf.default.mc_forwarding = 0 net.ipv4.conf.eth0.forwarding = 1 net.ipv4.conf.eth0.mc_forwarding = 0 net.ipv4.conf.eth1.forwarding = 1 net.ipv4.conf.eth1.mc_forwarding = 0 net.ipv4.conf.eth2.forwarding = 1 net.ipv4.conf.eth2.mc_forwarding = 0 net.ipv4.conf.lo.forwarding = 1 net.ipv4.conf.lo.mc_forwarding = 0 net.ipv6.conf.all.forwarding = 0 net.ipv6.conf.all.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.all.stable_secret" net.ipv6.conf.default.forwarding = 0 net.ipv6.conf.default.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.default.stable_secret" net.ipv6.conf.eth0.forwarding = 0 net.ipv6.conf.eth0.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.eth0.stable_secret" net.ipv6.conf.eth1.forwarding = 0 net.ipv6.conf.eth1.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.eth1.stable_secret" net.ipv6.conf.eth2.forwarding = 0 net.ipv6.conf.eth2.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.eth2.stable_secret" net.ipv6.conf.lo.forwarding = 0 net.ipv6.conf.lo.mc_forwarding = 0 sysctl: reading key "net.ipv6.conf.lo.stable_secret"
전달이 활성화되었습니다.
ip addr show
IP 주소는 괜찮습니다. Cisco Packet Tracer에서 확인했습니다.
ip -6 addr show
ipv6이 구성되지 않았습니다.
iptables -L
결과:
`체인 INPUT(정책 ACCEPT) 대상 보호 옵션 소스 대상
체인 FORWARD(정책 승인) 대상 보호 옵션 소스 대상
체인 OUTPUT(정책 ACCEPT) 대상 보호 옵션 소스 대상`
iptables -S
결과:
-P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT
이제 기본값입니다.
Pinging
HostR(라우터,10.0.0.1,172.16.0.1)은 HostA, HostB에 핑을 보내고 HostC에는 핑을 보낼 수 없습니다.
HostA/HostB(10.0.0.5/.6)가 HostA/B, HostR에 ping을 보내고 HostC에는 연결할 수 없음
HostC(172.16.0.2)는 모두에게 핑을 보냅니다.
답변 주셔서 감사합니다. 이러한 결과에 대해 어떻게 생각하는지 말씀해 주십시오. 나는 지금 그것을 처리하려고 노력하고 있습니다. 돌파구가 생기면 보고하겠습니다.