Linux as a gateway (no NAT)

Posted by Hugo on Server Fault See other posts from Server Fault or by Hugo
Published on 2012-06-20T05:14:24Z Indexed on 2012/06/20 9:18 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

I'm trying to configure a linux server as a gateway/router, but I can't get it to work, and all information I've managed to find is NAT-related.

I have a public IP block for the gateway and devices behind it, so I want the gateway to simply route packets to the internet - again: no NATing!

I've managed to get the gateway to access the internet successfully (that was just a matter of configuring the IP and GW), and the computers behind it can communicate with it.

[EDIT: more info]

This is actually an IPv6 block (2800:40:403::0/48) (but I've found that most utilities and instructions can be easily adapted from IPv4 to IPv6 with little hastle).

The server has too ports:

  • wan: 2800:40:403::1/48
  • lan: 2800:40:403::3/48

One of the computers behind it is connected to it via a switch;

  • 2800:40:403::7/48

The wan interface on the server can ping6 www.google.com without issues. The lan interface on the server and the client can mutually ping each other without issues (as well as SSH, etc).

I've tried setting the server as a default gateway for the client, with no luck:

client # route -A inet6 add default gw 2800:40:403::3 dev eth1

server # cat /proc/sys/net/ipv6/conf/all/forwarding 
1

I don't want any filtering/firewalling/etc, just plain routing.

Thanks.

© Server Fault or respective owner

Related posts about linux

Related posts about ip