Включить маршрутизацию:
Bash
iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADEПоказать построутинг:
Bash
sudo iptables -L -n -v -t nat --line-numbershain PREROUTING (policy ACCEPT 332 packets, 44146 bytes)
num pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 325 packets, 43040 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 3486 packets, 497K bytes)
num pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 3485 packets, 497K bytes)
num pkts bytes target prot opt in out source destination
1 3486 497K LIBVIRT_PRT all -- * * 0.0.0.0/0 0.0.0.0/0
Chain LIBVIRT_PRT (1 references)
num pkts bytes target prot opt in out source destination
1 15 1505 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
2 0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
3 0 0 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
4 1 635 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
5 0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24
6 0 0 RETURN all -- * * 192.168.122.0/24 224.0.0.0/24
7 0 0 RETURN all -- * * 192.168.122.0/24 255.255.255.255
8 0 0 MASQUERADE tcp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
9 0 0 MASQUERADE udp -- * * 192.168.122.0/24 !192.168.122.0/24 masq ports: 1024-65535
10 0 0 MASQUERADE all -- * * 192.168.122.0/24 !192.168.122.0/24 