LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-06-2013, 07:40 PM   #1
jeammy
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,404

Rep: Reputation: Disabled
Easy.
  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
SAbhi
Member
 
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: 80
To permanently set ip forwarding do this:

Code:
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
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: Fedora,RedHat,CentOS,Gentoo
Posts: 1,138
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.
Code:
 i.eth1=>conteting internal LAN 192.169.10.xxx
 ii.eth0=>connecting Internet i.e external network (Here your public IP is connected ex: 68.68.2.1)
2.Set IP forwarding :
Code:
#vi /etc/sysctl.conf:
net.ipv4.ip_forward = 1
To enable the changes made in sysctl.conf you will need to run the command:
Code:
sysctl -p /etc/sysctl.conf
3.configure IPTABLES to allow routing

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

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


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


All times are GMT -5. The time now is 08:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration