Linux router on a single physical interface

Discussion in 'Linux Networking' started by iulian, Jul 13, 2014.

  1. iulian

    iulian New Member

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I have a Linux computer (CentOS 6.5), and I need to use it as a router using a single physical network interface (eth0) in order to route packets between four computers in different networks:

    PC01: ip 10.101.6.2 mask 255.255.255.0
    routes:
    10.102.6.2 10.101.6.1
    10.103.6.2 10.101.6.1
    10.104.6.2 10.101.6.1

    PC02: ip 10.102.6.2 mask 255.255.255.0
    routes:
    10.101.6.2 10.102.6.1
    10.103.6.2 10.102.6.1
    10.104.6.2 10.102.6.1

    PC03: ip 10.103.6.2 mask 255.255.255.0
    routes:
    10.101.6.2 10.103.6.1
    10.102.6.2 10.103.6.1
    10.104.6.2 10.103.6.1

    PC04: ip 10.104.6.2 mask 255.255.255.0
    routes:
    10.101.6.2 10.104.6.1
    10.102.6.2 10.104.6.1
    10.103.6.2 10.104.6.1

    Router:
    1. Enable ip forwarding:
    echo 1 > /proc/sys/net/ipv4/ip_forward

    2. Create subinterfaces (with the default gateway ip of each computer):
    ifconfig eth0:1 10.101.6.1 netmask 255.255.255.0 up
    ifconfig eth0:2 10.102.6.1 netmask 255.255.255.0 up
    ifconfig eth0:3 10.103.6.1 netmask 255.255.255.0 up
    ifconfig eth0:4 10.104.6.1 netmask 255.255.255.0 up

    I have ping PCs -> Router and Router -> PCs, but ping does not work from one PC to another (packets are not forwarded). All equipments are in a closed network.

    Could you help me? How could I solve the problem. Thank you.


    In the past I've done a similar configuration but with two different physical network interfaces (eth0 and eth1). ip_forwarding was working in this case.
  2. VitalkaDrug

    VitalkaDrug New Member

    Messages:
    19
    Likes Received:
    10
    Trophy Points:
    3

Share This Page