Translating between local and global IP address
Quoted 11 lines · Rob Sterenborg
Quoted 11 lines
internet | eth0 GATEWAY (Linux) eth1 | COMPUTER (Windows)COMPUTER has a local IP address ($IN), but I'd like to mangle packets going through GATEWAY so COMPUTER appears to have another IP address ($OUT) on the internet.
Let me add to this that the internet IP of the gateway is not $OUT, and connections initiated from a machine on the internet (to $OUT) should reach COMPUTER.
Quoted 10 lines
You should probably do this :
# Close your gateway.
iptables -P INPUT DROP
iptables -P FORWARD DROP# Accept forwarding and related.
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -i eth1 -o eth0 -s $IN -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -s $IN -j SNAT --to-source $OUT
Thank you.
Quoted 2 lines
And maybe you need a helper for your network game. You didn't mention "the name of the game".
The game is Age of Mythology.
Quoted 2 lines
I don't know what you are trying to achieve with "ifconfig eth0:1 $OUT" ?
I want packets originating from internet to $OUT to be accepted by the gateway and redirected to $IN. Without the ifconfig, the gateway appears to accept only packets to itself.
Quoted 4 lines
When SNAT-ing, the packets will appear to be coming from eth0 on the gateway with IP address $OUT which is your internet IP address. $OUT must be your internet IP address otherwise the reply packet will not be sent back to you.
I want the gateway to have an IP address of its own, distinct from $OUT.
Quoted 1 line
The game is Age of Mythology.
Mm. Don't know if you need a helper. Can't find anything on it.
Quoted 4 lines
I want packets originating from internet to $OUT to be accepted by the
gateway and redirected to $IN. Without the ifconfig, the gateway appears to accept only packets to itself.
Yes.
The gateway has 2 IP addresses, 1 public ($OUT) and 1 private ($IN). From the internet you can't reach $IN (nor any host in your LAN) unless you use NAT or have multiple public IP's to assign to hosts in your LAN.
Quoted 2 lines
I want the gateway to have an IP address of its own, distinct from $OUT.
I don't see the point in "appearing to come from another IP", because reply packets would not reach you anymore (private IP), or you'd have asymmetric routing (2nd public IP).
Or maybe someone should tell me what I'm missing that makes sense of it.
Rob.