13 lines
349 B
Bash
Executable File
13 lines
349 B
Bash
Executable File
#!/bin/bash
|
|
# Redirect traffic for 192.168.31.73 to 10.0.2.15
|
|
|
|
# Enable IP forwarding
|
|
sudo sysctl -w net.ipv4.ip_forward=1
|
|
|
|
# Add NAT rule to redirect packets
|
|
sudo iptables -t nat -A OUTPUT -d 192.168.31.73 -j DNAT --to-destination 127.0.0.1
|
|
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
|
|
|
|
echo "IP redirection set: 192.168.31.73 → 127.0.0.1"
|
|
|