Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-06-2013, 07:40 PM   #1
LQ Newbie
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
Post linux routing

pls help me out, how to set up routing on linux server
Old 08-06-2013, 08:14 PM   #2
Ser Olmy
Senior Member
Registered: Jan 2012
Distribution: Slackware
Posts: 2,470

Rep: Reputation: Disabled
  1. Enable routing (the exact procedure varies from distribution to distribution, but in the end it all boils down to writing a "1" to /proc/sys/net/ipv4/ip_forward)
  2. Add/remove routes from the routing table (with ip route add <network>/<prefix> via <gateway> or route add -net <network>/<prefix> gw <gateway>)
  3. Optional: Install a routing daemon like Quagga or Bird and set up a routing protocol
If you want more specific advice, you'll need to ask a more specific question.
Old 08-07-2013, 12:18 AM   #3
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 664

Rep: Reputation: 81
To permanently set ip forwarding do this:

vi /etc/sysctl.conf
net.ipv4.ip_forward = 1    #change the value from 0 to 1, save and exit

sysctl -p /etc/sysctl.conf  #run this command so that it can read the updated sysctl.conf file

service network restart   # restart the network service
Old 08-07-2013, 11:07 AM   #4
Senior Member
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,145
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
You can configure Linux Box as a router using below scenario :

1. PC/Server with two lan cards.
 i.eth1=>conteting internal LAN
 ii.eth0=>connecting Internet i.e external network (Here your public IP is connected ex:
2.Set IP forwarding :
#vi /etc/sysctl.conf:
net.ipv4.ip_forward = 1
To enable the changes made in sysctl.conf you will need to run the command:
sysctl -p /etc/sysctl.conf
3.configure IPTABLES to allow routing

iptables -F
# iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
# iptables --append FORWARD --in-interface eth1 -j ACCEPT
iptables -L

Last edited by prayag_pjs; 08-07-2013 at 11:09 AM.


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
Application specific routing (not routing p2p over vpn) tkalfaoglu Linux - Networking 1 06-15-2013 07:33 AM
Mutiple IPs and network cards routing (source policy routing?) shogun1234 Linux - Networking 1 01-17-2013 01:09 AM
Dynamic routing isn't done; static routing works for about 2 seconds for wireless gregorian Linux - Networking 7 02-19-2010 07:43 AM
pre routing , post routing and qos support msridhar87 Linux - Networking 0 02-13-2009 06:37 AM
real routing under nat routing nothingmuch Linux - Networking 4 10-27-2003 04:11 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:42 AM.

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