Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- computer A: 192.168.1.3 (eth0)
- computer B: 192.168.1.7 (eth0), 192.168.1.5 (eth1), 192.168.1.6 (eth2)
- sudo sudo ip route del
- sudo ip route add default via 192.168.1.6
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 0.0.0.0 192.168.1.6 0.0.0.0 UG 0 0 0 eth0
- 169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
- 192.168.1.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
- #!/bin/bash
- modprobe nf_conntrack
- modprobe nf_conntrack_ipv4
- modprobe nf_nat
- modprobe iptable_nat
- IF="eth2"
- ADDR="192.168.1.3"
- sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
- sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_dynaddr'
- sudo iptables -P INPUT ACCEPT
- sudo iptables -F INPUT
- sudo iptables -P OUTPUT ACCEPT
- sudo iptables -F OUTPUT
- sudo iptables -P FORWARD DROP
- sudo iptables -F FORWARD
- sudo iptables -t nat -F
- sudo iptables -A FORWARD -i $IF -o $IF --source $ADDR -j ACCEPT
- sudo iptables -A FORWARD -i $IF -o $IF --destination $ADDR -m state --state ESTABLISHED,RELATED -j ACCEPT
- sudo iptables -t nat -A POSTROUTING -s $ADDR -j MASQUERADE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement