Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can I setup a centos server as Router with 2 Nic's..eth1 for LAN and eth0 for Wan interface. But my modem/router is configured as a router and not in bridge mode. I need to make my linux system as the router and default gateway and have the advantage of iptables firewall etc rather than the modem/router being the internet gateway for my LAN.

My server ip is 192.168.1.10 255.255.255.0 Modem?router is 192.168.1.1 Lan 192.168.1.3 ....etc..etc..

Please, how can this setup on my server and LAN ???? Waiting for a detailed answer...

share|improve this question
    
Are you just re-asking the same question you asked 4 hours ago with less detail? superuser.com/questions/315078/… –  Zoredache Jul 26 '11 at 6:39
    
Sorry...but I have rephrased my question and I did not get an answer from superuser –  shels Jul 26 '11 at 6:44
    
Waiting for detailed answer, need to have detailed question. Put more detailed in you question, and you'll get more efficient answer ;) –  Anarko_Bizounours Jul 26 '11 at 6:50
add comment

2 Answers

To allow your system to act as a router you need to enable IP forwarding.

You can do instantly with this with

sudo echo 1 > /proc/sys/net/ipv4/ip_forward

This will only enable routeing until the next time the system is restarted. To ensure that the system routes permanently edit /etc/sysctl.conf and ensure there is a line that says

net.ipv4.ip_forward = 1
share|improve this answer
    
I have enabled ipforwarding etc..etc and my network is working fine...the existing setup used a bridged modem but now I have a router/modem..I want my Centos server to act as gateway rather than the modem/router as gateway.. –  shels Jul 26 '11 at 6:43
add comment

I'd recommend 2 HOWTOs:

This one: http://www.netfilter.org/documentation/HOWTO//NAT-HOWTO.html will let you configure your NAT (look for the section "I just want masquerading! Help!").

This one will give you some basics on networking: http://www.netfilter.org/documentation/HOWTO//networking-concepts-HOWTO.html.

The HOWTOs are rather old (made for 2.4 kernels), but they are still relevant.

share|improve this answer
    
Sorry..this is not a question about NAT etc,...I think I need to create 2 subnets....one for my server and modem/router and another subnet for my LAN through my switch.. –  shels Jul 26 '11 at 7:15
    
If you want to communicate with Internet you need either routable IP address for each host (192.168.1.0/24 is not routable) or you need NAT. If you put your hosts in network A, but your WAN modem in netowrk B you'd need to set up routing on the WAN or it would not know to deliver packets to network A through your server's interface in network B. –  Paweł Brodacki Jul 26 '11 at 8:13
    
My modem router is 192.168.1.1 which is connected to eth0 with ip 192.168.1.2 and my LAN (eth1) is 192.168.2.10 and one of my client is ip 192.168.2.3...setup iptabes to MASQUERADE and got it working...So LAN and WAN should be on different subnets...that is the point to be remembered –  shels Jul 26 '11 at 13:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.