I want to configure my Linux so that it will be used as a network router (gateway). Can anybody give me some hints on this? (links are welcome!)
How to build a gateway from my Linux OS
linux;networking;ip;routing;router
For a simple router, there are really only two steps that need to be done.Enable routingThe first step is to enable routing in the kernel. By default, the kernel drops packets that it doesn't recognize; once you enable routing, it'll forward them. You need to issue either of these two commands when the computer boots:sysctl -w net.ipv4.ip_forward=1echo 1 >/proc/sys/net/ipv4/ip_forwardMany distributions have a file called /etc/sysctl.conf, where you can put the line net.ipv4.ip_forward=1 to execute that command when the computer boots. If there's a directory /etc/sysctl.d, you can add a file in that directory instead of editing /etc/sysctl.conf; call the file something.conf.For IPv6, the corresponding setting is net.ipv6.conf.all.forwarding or /proc/sys/net/ipv6/conf/all/forwarding. You can also use net.ipv4.conf.all.forwarding or /proc/sys/net/ipv4/conf/all/forwarding for IPv4.Set routing tablesThe second step is to set routing tables. This can be simple or complicated depending on how much you need to do. For simple uses, configure each of your network interfaces' address and netmask, and add any needed extra route with the route command.Going beyond simple routingIf you need to rewrite packets, the basic command is iptables (ip6tables for IPv6). (Netfilter is the name of the kernel packet handling facility, and iptables if the name of the program that controls it.) This is where to look for filtering, NAT and more.For complex setups, look at the ip command from the iproute2 package.