No announcement yet.

How to Turn a Linux Server into a Router to Handle Traffic

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Turn a Linux Server into a Router to Handle Traffic

     # ip route show   
     # ip route add via dev enp0s3   
     # ip route add via dev enp0s3   
     # echo 1 > /proc/sys/net/ipv4/ip_forward
    To make these settings persistent across boots, edit /etc/sysctl.conf on the router and make sure the net.ipv4.ip_forward variable is set to true as follows:
    net.ipv4.ip_forward = 1
    In addition, configure the NICs on both clients (look for the configuration file within /etc/sysconfig/network on openSUSE and /etc/sysconfig/network-scripts on CentOS – in both cases it’s called ifcfg-enp0s3). Here’s the configuration file from the openSUSE box:
    Using a Linux server to route packages between a private networks and the Internet

    Another scenario where a Linux machine can be used as router is when you need to share your Internet connection with a private LAN.

    Router: Debian Wheezy 7.7 [eth0: Public IP, eth1:] - dev2 Client: openSUSE 13.2 [enp0s3:] - dev4 In addition to set up packet forwarding and the static routing table in the client as in the previous example, we need to add a few iptables rules in the router:
     # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT # iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
    The first command adds a rule to the POSTROUTING chain in the nat (Network Address Translation) table, indicating that the eth0 NIC should be used for outgoing packages.
    MASQUERADE indicates that this NIC has a dynamic IP and that before sending the package to the “wild wild world” of the Internet, the private source address of the packet has to be changed to that of the public IP of the router.
    In a LAN with many hosts, the router keeps track of established connections in /proc/net/ip_conntrack so it knows where to return the response from the Internet to.
    Only part of the output of:
     # cat /proc/net/ip_conntrack

  • #2
    The handling technique you are explaining traffic into a router is good. But I apply the technique you are explaining but after that my router shows me Wii Error Code 51330 and I don't know how to solve it. If you know how to solve it then let me know.
    Top Most Step To fix Wii error code 51330 by Router Technical Support expertise Team. Get In Touch with Router support phone number +1-800-966-6991 (Toll-Free) for Router Customer Support service to repair router, Install, Re-install and Configuration setup