Linux router on a single physical interface

I

iulian

Guest
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.
 



Staff online

Members online


Latest posts

Top