ping между интерфейсами одного хоста
подскажите, пожалуйста, что нужно сделать для того, чтобы между разными интерфейсами одного хоста ходили пинги?
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.22.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.62.0 0.0.0.0 255.255.255.0 U 0 0 0 vpn0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.22.221 0.0.0.0 UG 0 0 0 eth0
eth0=192.168.22.124
vpn0=192.168.62.1
iptables -t nat -I POSTROUTING -s 192.168.62.0/24 -o eth0 -j MASQUERADE
iptables -t nat -I POSTROUTING -s 192.168.22.0/24 -o vpn0 -j MASQUERADE
cat /proc/sys/net/ipv4/ip_forward
1
при ping -I eth0 192.168.62.1 -c 1:
tcpdump -nn -i any 'ip proto \icmp' and host 192.168.22.124
14:50:29.347279 IP 192.168.22.124 > 192.168.62.1: ICMP echo request, id 57883, seq 1, length 64
т.е. request имеется, нет response
- Для комментирования войдите или зарегистрируйтесь
Ну а форвардинг разрешить
Ну а форвардинг разрешить забыли?
iptables -I FORWARD -i eth0 -o vpn0 -j ACCEPT
iptables -I FORWARD -i vpn0 -o eth0 -j ACCEPT
Да пребудет с тобой великий Linux.
не помогло
не помогло, то же самое, request есть, response нет.
iptables -L -t filter -v
Chain INPUT (policy ACCEPT 243M packets, 127G bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 182K packets, 15M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- vpn0 eth0 anywhere anywhere
0 0 ACCEPT all -- eth0 vpn0 anywhere anywhere
Chain OUTPUT (policy ACCEPT 231M packets, 116G bytes)
pkts bytes target prot opt in out source destination
iptables -L -t nat -v
Chain PREROUTING (policy ACCEPT 47M packets, 2723M bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 3981K packets, 258M bytes)
pkts bytes target prot opt in out source destination
23 1818 MASQUERADE all -- any vpn0 192.168.22.0/24 anywhere
0 0 MASQUERADE all -- any eth0 192.168.62.0/24 anywhere
Chain OUTPUT (policy ACCEPT 3944K packets, 255M bytes)
pkts bytes target prot opt in out source destination
не помогло, результат тот же
iptables -L -t filter -v:
Chain INPUT (policy ACCEPT 243M packets, 127G bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 182K packets, 15M bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- vpn0 eth0 anywhere anywhere
0 0 ACCEPT all -- eth0 vpn0 anywhere anywhere
Chain OUTPUT (policy ACCEPT 231M packets, 116G bytes)
pkts bytes target prot opt in out source destination
iptables -L -t nat -v:
Chain PREROUTING (policy ACCEPT 47M packets, 2723M bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 3981K packets, 258M bytes)
pkts bytes target prot opt in out source destination
23 1818 MASQUERADE all -- any vpn0 192.168.22.0/24 anywhere
0 0 MASQUERADE all -- any eth0 192.168.62.0/24 anywhere
Chain OUTPUT (policy ACCEPT 3944K packets, 255M bytes)
pkts bytes target prot opt in out source destination
как насчет ? iptables -I
как насчет ?
iptables -I INPUT 1 -i lo -j ACCEPT
iptables -I OUTPUT 1 -o lo -j ACCEPT
без результата
iptables -L -t filter -v
Chain INPUT (policy ACCEPT 263M packets, 145G bytes)
pkts bytes target prot opt in out source destination
431 31174 ACCEPT all -- lo any anywhere anywhere
Chain FORWARD (policy ACCEPT 235K packets, 24M bytes)
pkts bytes target prot opt in out source destination
22 3816 ACCEPT all -- vpn0 eth0 anywhere anywhere
26 7064 ACCEPT all -- eth0 vpn0 anywhere anywhere
Chain OUTPUT (policy ACCEPT 251M packets, 136G bytes)
pkts bytes target prot opt in out source destination
345 25342 ACCEPT all -- any lo anywhere anywhere
ping -I eth0 -c 1 192.168.62.1
одна строка IP 192.168.22.124 > 192.168.62.1: ICMP echo request, id 52071, seq 1, length 64
ping -I vpn0 -c 1 192.168.22.124
IP 192.168.62.1 > 192.168.62.1: ICMP host 192.168.22.124 unreachable, length 92
Потому что запрос уходит
Потому что запрос уходит наружу, а ответ приходит по внутреннему (см. таблицу маршрутизации).
А зачем это нужно??