LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-13-2014, 06:02 AM   #1
iulian
LQ Newbie
 
Registered: Jul 2014
Posts: 2

Rep: Reputation: Disabled
Linux router on a single physical interface


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.
 
Old 07-14-2014, 01:06 AM   #2
roger_heslop
Member
 
Registered: Oct 2009
Location: Leander, TX
Distribution: Fedora 20
Posts: 97

Rep: Reputation: 35
I'll go out on a limb here, have you had the opportunity to test without the firewall on the Linux router?
Sometimes rules are made to allow packets to be forward from, or out some interface, but are appended after:

REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

...which drops the packet.
 
Old 07-14-2014, 02:08 PM   #3
iulian
LQ Newbie
 
Registered: Jul 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
I used these commands to stop the firewall, but does not seems to work.

# service iptables save
# service iptables stop
# chkconfig iptables off
 
Old 07-14-2014, 02:45 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,050

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
Why don't you go outside of the subnet for each virtual ip address? Not sure it matters but seems odd to me.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to know Linux internals on multiple IPv6 addresses on single interface. itismohit Linux - Software 5 08-30-2011 01:11 PM
Single physical nic with two ip's on the same vlan pgb205 Linux - Networking 3 08-23-2011 07:57 PM
Single interface linux router rhlee Linux - Networking 10 10-22-2009 02:34 AM
how can i shutdown the PHYSICAL interface of an ethernet interface markraem Linux - Networking 2 04-12-2007 02:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration