LinuxQuestions.org
Help answer threads with 0 replies.
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 04-13-2012, 05:23 AM   #1
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Rep: Reputation: 1
Unhappy IP Forwarding not working in CentOS 5


Hi,

I have two nic card insatlled, eth0 is wan IP(dhcp)
eth1-LAN IP which is static.

Code:
[root@localhost ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:50:BA:BB:CB:8E  
          inet addr:192.168.1.226  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::250:baff:febb:cb8e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1262 errors:0 dropped:0 overruns:0 frame:0
          TX packets:395 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:282366 (275.7 KiB)  TX bytes:37885 (36.9 KiB)
          Interrupt:169 Base address:0x4800 

eth1      Link encap:Ethernet  HWaddr 00:80:C8:27:3B:ED  
          inet addr:192.168.2.1  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::280:c8ff:fe27:3bed/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:228 errors:1 dropped:0 overruns:0 frame:0
          TX packets:96 errors:6 dropped:0 overruns:0 carrier:6
          collisions:0 txqueuelen:1000 
          RX bytes:14184 (13.8 KiB)  TX bytes:14348 (14.0 KiB)
          Interrupt:201 Base address:0x2c00
i have enabled IP forwarding.
Code:
[root@localhost ~]# cat /proc/sys/net/ipv4/ip_forward                                                                                        
1
also did NAT and follwed the below URL

http://www.howtoforge.com/nat_iptables

Code:
[root@localhost ~]# sysctl -p /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
Code:
[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
Code:
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
but still if i connect a client pc/laptop and assign static IP (i.e IP-192.168.2.5 Mask:255.255.0.0 gw- 192.168.2.1 and DNS 8.8.8.8)

still not able to connect to internet. Please help
I Don't know what is really wrong??? Is DNS is the issue??

Last edited by varunb; 04-13-2012 at 05:26 AM.
 
Old 04-13-2012, 05:37 AM   #2
Nermal
Member
 
Registered: Jan 2009
Distribution: Debian
Posts: 59
Blog Entries: 2

Rep: Reputation: 6
I think you need to change the subnet on you Internal LAN to 255.255.255.0

It kinda breaks it.
 
Old 04-13-2012, 05:46 AM   #3
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Hi,

I changed
Code:
eth1      Link encap:Ethernet  HWaddr 00:80:C8:27:3B:ED  
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::280:c8ff:fe27:3bed/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1779 errors:1 dropped:0 overruns:0 frame:0
          TX packets:413 errors:6 dropped:0 overruns:0 carrier:6
          collisions:0 txqueuelen:1000 
          RX bytes:125457 (122.5 KiB)  TX bytes:53274 (52.0 KiB)
          Interrupt:201 Base address:0x2c00
also followed the iptables flush and deleting steps again.
but still the same issue.

Code:
[root@localhost ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
RH-Firewall-1-INPUT  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     icmp --  anywhere             anywhere            icmp any 
ACCEPT     esp  --  anywhere             anywhere            
ACCEPT     ah   --  anywhere             anywhere            
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns 
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp 
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp 
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
 
Old 04-13-2012, 06:51 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Okay what was your iptables script for forwarding the requests from one network card to another? And are you using some proxy like squid?
 
Old 04-13-2012, 09:03 AM   #5
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by linuxlover.chaitanya View Post
Okay what was your iptables script for forwarding the requests from one network card to another? And are you using some proxy like squid?
actually i wanted to enable dhcp and iptables for controlling and managing packets.
i have not installed dhcp still!!! i just want to check whether it works by giving static IP to client pc.
 
Old 04-14-2012, 03:49 AM   #6
Nermal
Member
 
Registered: Jan 2009
Distribution: Debian
Posts: 59
Blog Entries: 2

Rep: Reputation: 6
Oki Doki, can you let us have your routing please

netstat -rn

or are you looking to Nat behind this box?

And finally can the server see the outside world?

Last edited by Nermal; 04-14-2012 at 04:44 AM.
 
Old 04-16-2012, 09:14 AM   #7
varunb
Member
 
Registered: Mar 2011
Location: Bangalore, INDIA
Distribution: opensuse, fedora
Posts: 135
Blog Entries: 1

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Nermal View Post
Oki Doki, can you let us have your routing please

netstat -rn

or are you looking to Nat behind this box?

And finally can the server see the outside world?
hi Thankz fr the reply!!!

i couldn't wait, so installed shorewall and configured
as of now its working!!! but ans to my question remains same!!!

soon i will post the output of netsat command. .
 
Old 04-17-2012, 04:05 AM   #8
henrycoffin
Member
 
Registered: Dec 2006
Distribution: RHEL Debian
Posts: 42

Rep: Reputation: 15
I can't see your nat table. Can you post it please?

# iptables -t nat -L
 
  


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
[SOLVED] X forwarding on SSH in CentOS tkmsr Linux - Server 1 05-25-2010 01:54 PM
IP forwarding not working on Centos server jlowry Linux - Networking 6 01-19-2010 12:02 PM
Port forwarding using IP Tables from Centos to windows drstupid Linux - Networking 7 12-03-2009 11:44 AM
IP Forwarding not working in CentOS 5 tomwerner Linux - Networking 9 05-19-2008 12:47 PM
email forwarding problem CentOS johncereus Linux - General 15 07-11-2006 05:15 PM


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