LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 01-24-2007, 12:58 AM   #1
SBN
Member
 
Registered: Jul 2006
Distribution: UBUNTU, CentOS, FEDORA 8
Posts: 474

Rep: Reputation: 30
IP Forwarding


- Hey guys what is IP Forwarding and how do you set it up in Centos and UBUNTU?
 
Old 01-24-2007, 01:44 AM   #2
Notwerk
Member
 
Registered: Apr 2005
Location: Jordan
Distribution: Debian (Sarge), Ubuntu (6.06)
Posts: 271

Rep: Reputation: 31
IP Forwarding allows traffic from one network to be passed to another network. In other words, a machine with IP forwarding enabled can act as a router.

For example traffic from 192.168.1.0/24 will be allowed to pass to 192.168.2.0/24 (all traffic is still subject to iptables rules ofcourse).

To turn IP forwarding on in Ubuntu use:
#echo 1 > /proc/sys/net/ipv4/ip_forward

and to turn it off use:
#echo 0 > /proc/sys/net/ipv4/ip_forward

Note that there is a config file you can edit to enable/disable ip forwarding whenever the machine starts, but i can't remember the path right now

Finally, you'll need to add the proper routes to the kernel routing table so the machine nows what traffic to forward and where to forward it to.
For this you can #man route

Cheers
 
Old 01-24-2007, 04:30 PM   #3
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
What if I were to forward packets within the same LAN? Do I still need to enable IP forwarding?
 
Old 01-24-2007, 04:49 PM   #4
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Quote:
Originally Posted by Notwerk
Note that there is a config file you can edit to enable/disable ip forwarding whenever the machine starts, but i can't remember the path right now
Do you mean /etc/sysctl.conf? If you put the following in that file and run sysctl -p it has the same effect:
Code:
net.ipv4.ip_forward = 1
Quote:
Originally Posted by Micro420
What if I were to forward packets within the same LAN? Do I still need to enable IP forwarding?
If your box only has one NIC in it, it sounds like iptables would be a better choice.
 
Old 01-25-2007, 09:55 PM   #5
SBN
Member
 
Registered: Jul 2006
Distribution: UBUNTU, CentOS, FEDORA 8
Posts: 474

Original Poster
Rep: Reputation: 30
- is it possible to use IP Forwading to connect different networks and do you have to learn iptables if you are dealing with IP Forwarding.
 
Old 01-26-2007, 07:49 PM   #6
xjlittle
Member
 
Registered: Aug 2003
Location: Indiana
Distribution: fc6 sles9 & 10 kubuntu ubuntu-server
Posts: 240
Blog Entries: 2

Rep: Reputation: 30
Quote:
Originally Posted by SBN
- is it possible to use IP Forwading to connect different networks and do you have to learn iptables if you are dealing with IP Forwarding.
If you have IP forwarding on and IP tables off, two nics on the machine, one connected to one network and other connected to the second network it will work.

However, if you are not using ip tables you will get traffic (read access and insecure)both ways.
 
Old 01-26-2007, 11:37 PM   #7
SBN
Member
 
Registered: Jul 2006
Distribution: UBUNTU, CentOS, FEDORA 8
Posts: 474

Original Poster
Rep: Reputation: 30
Quote:
If you have IP forwarding on and IP tables off, two nics on the machine, one connected to one networ
k and other connected to the second network it will work.
- so how do i configure IP Forwarding to connect 2 different networks.
 
Old 01-27-2007, 02:10 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just search this site of google for hundreds of identical questions. indeed just look at the bottom of this page in the similar threads box.
 
  


Reply



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
Mail Forwarding in postfix/maildrop/redhat (like yahoo mail forwarding) topcat Linux - Software 1 08-31-2007 12:10 PM
IPCHAINS port forwarding and IPTABLES port forwarding ediestajr Linux - Networking 26 01-14-2007 07:35 PM
Simple Port Forwarding Firewall - not forwarding MadTurki Linux - Security 14 04-09-2006 12:08 PM
IP forwarding vkumarme Linux - Networking 1 03-07-2005 03:51 AM
port forwarding and packet forwarding syrtsardo Linux - Newbie 2 07-03-2003 10:37 AM

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

All times are GMT -5. The time now is 07:25 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