Kod: Zaznacz cały
iptables -A FORWARD -i eth1 -s 83.18.234.26 -d 1433 -p tcp --dport 1433 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp -s 83.18.234.26 --dport 1433 -j DNAT --to-destination 192.168.0.240
iptables -A FORWARD -i eth1 -s 83.18.234.26 -d 1434 -p udp --dport 1434 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p udp -s 83.18.234.26 --dport 1434 -j DNAT --to-destination 192.168.0.240
Potem wydając dwa następujące polecenia, aby sie upewnić czy wszystko jest OK
Kod: Zaznacz cały
debian:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DROP tcp -- 192.168.0.2 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.3 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.4 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.5 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.6 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.7 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.8 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.9 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.10 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.11 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.12 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
DROP tcp -- 192.168.0.13 anywhere #conn/32 > 50 ipp2p v0.8.0_rc3 --ipp2p
ACCEPT all -- 192.168.0.2 anywhere MAC 00:0C:76:E3:92:23
ACCEPT all -- 192.168.0.3 anywhere MAC 00:15:F2:17:BB:5A
ACCEPT all -- 192.168.0.4 anywhere MAC 00:18:F3:17:89:F3
ACCEPT all -- 192.168.0.5 anywhere MAC 00:C0:26:A3:8B:BE
ACCEPT all -- 192.168.0.6 anywhere MAC 00:0B:6A:C3:A9:63
ACCEPT all -- 192.168.0.7 anywhere MAC 00:C:D F:0F:97:46
ACCEPT all -- 192.168.0.8 anywhere MAC 00:0F:1F :D F:69:A5
ACCEPT all -- 192.168.0.9 anywhere MAC 00:15:F2:4B:3F:FA
ACCEPT all -- 192.168.0.12 anywhere MAC 00:11:43:A5:FC :D 3
ACCEPT all -- 192.168.0.13 anywhere MAC 00:14:85:3D:EA:95
ACCEPT all -- 192.168.0.14 anywhere MAC 00:06:5B:65:90:26
ACCEPT all -- anywhere 192.168.0.0/24 state NEW,RELATED,ESTABLISHED
ACCEPT tcp -- 83.18.234.26 0.0.5.153 tcp dpt:ms-sql-s
ACCEPT udp -- 83.18.234.26 0.0.5.154 udp dpt:ms-sql-m
oraz
Kod: Zaznacz cały
debian:~# iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 71906 packets, 5170K bytes)
pkts bytes target prot opt in out source destination
1 48 DNAT tcp -- eth0 * 83.18.234.26 0.0.0.0/0 tcp dpt:1433 to:192.168.0.240
0 0 DNAT udp -- eth0 * 83.18.234.26 0.0.0.0/0 udp dpt:1434 to:192.168.0.240
Chain POSTROUTING (policy ACCEPT 110 packets, 6033 bytes)
pkts bytes target prot opt in out source destination
798 74926 MASQUERADE all -- * eth0 192.168.0.0/24 0.0.0.0/0
Chain OUTPUT (policy ACCEPT 103 packets, 5697 bytes)
pkts bytes target prot opt in out source destination
debian:~#