LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 12-13-2012, 01:14 AM   #1
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Rep: Reputation: 34
Redhat as a router not working


Hi though I have configured net.ipv4.ip_forward=1 and firewall is down, I am unable to route via this machine. There are no issue If I try to access sourc and the destination from the router.

I am running Redhat 5.3 and 2 x NICs

Thanks and Best Regards
 
Old 12-13-2012, 01:32 AM   #2
bala.linuxtech
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: RHEL and Centos
Posts: 82

Rep: Reputation: Disabled
Quote:
Originally Posted by procfs View Post
Hi though I have configured net.ipv4.ip_forward=1 and firewall is down, I am unable to route via this machine. There are no issue If I try to access sourc and the destination from the router.

I am running Redhat 5.3 and 2 x NICs

Thanks and Best Regards
Hi

Could you display your ip settings/ sysctl.conf file ?
 
Old 12-13-2012, 01:34 AM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
You'll have to configure the route. Did you do that? please post the ouput of the command
Code:
route
Markus
 
Old 12-13-2012, 02:01 AM   #4
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
Hi Guys thank you for the replies below are the details you requested

IP settings

# VIA Technologies, Inc. VT6105/VT6106S [Rhine-III]
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:1E:58:A7:6F:11
IPV6INIT=no
IPV6_AUTOCONF=no
ONBOOT=yes
TYPE=Ethernet
PEERDNS=yes
USERCTL=no
NETMASK=255.255.255.0
IPADDR=192.168.11.73

# Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
DEVICE=eth1
BOOTPROTO=static
HWADDR=00:C0:26:2E:BC:BD
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
IPADDR=192.168.1.250
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

sysctl.comf

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes
kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 4294967295

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 268435456

kernel.hostname = sysgate
kernel.domainname = iil.informatics.lk


Route -n

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.11.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
default 192.168.1.1 0.0.0.0 UG 0 0 0 eth1


Thanks and Regards
 
Old 12-13-2012, 04:35 AM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Quote:
Originally Posted by procfs View Post
...
IPADDR=192.168.1.250
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
...
Well, I'm not an expert. But when I configure my laptop as wireless accesspoint, its gateway and ip adress are the same.

Do you use DHCP? which ip settings do the clients in your 192.168.1.0/24 network have? Could you please check the output of ifconfig on any client?

Markus

Last edited by markush; 12-13-2012 at 04:37 AM. Reason: typo
 
Old 12-13-2012, 04:58 AM   #6
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
Hi Markush,

192.168.11.0 range is the client side and 192.168.1.0 range is internal connection to a leased line router and its IP is 192.168.1.1. So what I want to do the what ever the traffic comes to eth0 (192.168.11.73) should be routed to 192.168.1.1

Thanks and Best Regards
 
Old 12-13-2012, 05:05 AM   #7
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Ah, yes, I didn't understand you setup correctly.

Markus
 
Old 12-13-2012, 05:11 AM   #8
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
No worries Markush, I dont understand every thing seems to be working fine, I can reach both ip ranges from the router to be machine but it just refuse to route
 
Old 12-13-2012, 09:31 AM   #9
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by procfs View Post
Hi though I have configured net.ipv4.ip_forward=1 and firewall is down, I am unable to route via this machine.
So you're trying to configure this host as a router? If so, you will probably want to use iptables, and a host of rules to forward traffic between the two interfaces. What is the use case for your desired router: home network, routing between subnets on a LAN, other? There are commonly packages or tools to assist in creating an appropriate set of rules, and I suggest using them, unless you have significant expertise in creating routers or other networking devices using Linux.

--- rod.

Last edited by theNbomr; 12-13-2012 at 09:32 AM.
 
Old 12-13-2012, 11:06 AM   #10
mandyapenguin
Member
 
Registered: Nov 2011
Location: India
Distribution: RedHat, Cent OS, Fedora, Debian, Ubuntu
Posts: 106

Rep: Reputation: Disabled
Have you already ran these below commands?
Code:
iptables -A INPUT -i $INTERNET_INTERFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface $INTERNET_INTERFACE -j MASQUERADE
iptables --append FORWARD --in-interface $LAN_INTERFACE -j ACCEPT
Just change $INTERNET_INTERFACE & $LAN_INTERFACE as eth1 or eth0 according your settings and also see how to setup Linux as a router.
 
Old 12-13-2012, 11:20 AM   #11
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
Hi Guys, so just enabling net.ipv4.ip_forward is not enough is it? I need to configure iptables as well to start the IP forwarding? I though otherwise, you just have to enable net.ipv4.ip_forward to get a basic route going for starters

Thanks and Regards
 
Old 12-13-2012, 11:45 AM   #12
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,130

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
does this help:
http://www.linuxquestions.org/questi...6/#post3804866
 
Old 12-14-2012, 09:08 AM   #13
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
Hi Thanks you all for the replies, so conclution as per all the documentation I need to configure Firewall to forward packets and just by enabling net.ipv4.ip_forward will not work?

Let me try this and get back to you

Thanks and Best Regards
 
Old 12-14-2012, 09:32 AM   #14
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,397
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Your question casts some confusion. The 'route' command is not really related to the concept of using the host as a router. Setting routes is used to tell the IP stack how to send packets from the host, on an appropriate interface and/or to an appropriate gateway. Using the host as a router/firewall is a separate matter, and uses iptables rules (lots of them for a well configured setup) to configure appropriate routing of traffic between LANs or LANs and WAN. The central difference has to do with where the data originates: either on the host itself, or on some other host & requiring traversal of the router to a host on a different network.
You really need to explain what your objective is (just setting up routes, or configuring the host as a router), so people can answer accordingly. I see answers here that seem to touch on both sides.
--- rod.
 
Old 12-14-2012, 11:59 AM   #15
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 608

Original Poster
Rep: Reputation: 34
Hi theNbomr, thank you for the explanation. my senario is as below

I have tow sub-nets one is 192.168.11.0 and the other is 192.168.1.0 can I use Redhat linux box to route packets between these two networks without having to configure firewall (host as a router)

Since I did the above just a linux box with 2 network interfaces, facing 11 and 1 ranges. I have enabled net.ipv4.ip_forward = 1 and added its default gate way as 192.168.1.1 since this is yet another router facing the internet. Since 11 and 1 ranges are known to the router I dont think I have to add any specific route to routing table. And the firewall is off

My problem is when I try to ping 192.168.1.1 (internet route) from 192.168.11.120 (client in 11 range and its gateway is set to 192.168.11.254 (linux box which I am trying to configure as router)) I get a time out. If I to do a traceroute to 192.168.1.1 it will go up to 192.168.11.254 and stops with *****. But I can ping from the route to be to any machine on 11 rang and 192.168.1.1 route

I dont understand what I going on. as per help I got it looks like I need firewall as well to achieve my objective

Thanks and Regards

Last edited by procfs; 12-14-2012 at 12:03 PM.
 
  


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
redhat network working but no internet thru router pengy666 Linux - Networking 6 05-10-2005 08:16 AM
redhat 7.1 as a router aristeidis Linux - Networking 0 03-22-2004 07:16 AM
can't see outside behind Redhat router KitM Linux - Networking 7 01-20-2004 06:46 PM
redhat 9 causing linksys router to stop working martygehrke Linux - Networking 1 11-13-2003 06:51 PM
RedHat 7.3 Router komakala Linux - Networking 2 10-24-2003 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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