LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-29-2010, 11:11 PM   #1
troiwulful
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0 (CentOS 5.5)


Hi all,

I'm forging a gateway server, We have 2 Internet connection that goes to a load balancer router, and goes to my centos server and from our server goes to a switch for Internet distribution or routing.

OS-CentOS 5.5

[root@server etc]# uname -srio
Linux 2.6.18-194.el5 i386 GNU/Linux



My eth0 and eth1 has the following configuration and IP

[root@server etc]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# VIA Technologies, Inc. VT6105/VT6106S [Rhine-III]
DEVICE=eth0
BOOTPROTO=none
HWADDR=1C:BD:B9:80:07:A1
ONBOOT=yes
DHCP_HOSTNAME=server.cec.com
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=yes
PEERDNS=yes

[root@server etc]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# VIA Technologies, Inc. VT6105/VT6106S [Rhine-III]
DEVICE=eth1
BOOTPROTO=none
HWADDR=1C:BD:B9:80:07:6E
ONBOOT=yes
HOTPLUG=no
DHCP_HOSTNAME=server.cec.com
IPADDR=192.168.0.10
NETMASK=255.255.255.0
TYPE=Ethernet
USERCTL=no
IPV6INIT=yes
PEERDNS=yes

Changed sysctl.conf - net.ipv4.ip_forward =1
[root@server etc]# sysctl -p
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

MASQUERADE eth0
[root@server etc]# iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Changed dhcpd.conf to route internet at eth1 and set range
[root@server etc]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
DHCPARGS=eth1;
subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.0.10;
option subnet-mask 255.255.255.0;

option nis-domain "static.pldt.net";
option domain-name "static.pldt.net";
option domain-name-servers 58.69.254.3, 58.69.254.8;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.0.100 192.168.0.200;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server static.pldt.net;
hardware ethernet 1C:BD:B9:80:07:6E;
fixed-address 58.69.254.3, 58.69.254.8;
}
}
[root@server etc]#

But when I restart network i get the following
[root@server etc]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]
[root@server etc]#
[root@server etc]#

Disabling IPv4 packet forwarding
but i already changed it to 1 at sysctl.conf

One of the online forum says i need to configure the named.conf
deleted some and run it(named.conf) and successful but still when I run network service I still get the :
"Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0"

The network is getting the IP range but it doesnt get any Internet connection.

I'm a novice and any help will be greatly appreciated.

Thank you.
 
Old 10-30-2010, 05:27 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,220
Blog Entries: 1

Rep: Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074Reputation: 2074
Hi,

Make sure you have a "1" in /proc/sys/net/ipv4/ip_forward. If it's a "0" you can run:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
to set it.

Regards
 
Old 11-02-2010, 02:49 AM   #3
divyashree
Senior Member
 
Registered: Apr 2007
Location: Bangalore, India
Distribution: RHEL,SuSE,CentOS,Fedora,Ubuntu
Posts: 1,386

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by troiwulful View Post
Hi all,

I'm forging a gateway server, We have 2 Internet connection that goes to a load balancer router, and goes to my centos server and from our server goes to a switch for Internet distribution or routing.

OS-CentOS 5.5

[root@server etc]# uname -srio
Linux 2.6.18-194.el5 i386 GNU/Linux



My eth0 and eth1 has the following configuration and IP

[root@server etc]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
# VIA Technologies, Inc. VT6105/VT6106S [Rhine-III]
DEVICE=eth0
BOOTPROTO=none
HWADDR=1C:BD:B9:80:07:A1
ONBOOT=yes
DHCP_HOSTNAME=server.cec.com
IPADDR=192.168.0.5
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=yes
PEERDNS=yes

[root@server etc]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
# VIA Technologies, Inc. VT6105/VT6106S [Rhine-III]
DEVICE=eth1
BOOTPROTO=none
HWADDR=1C:BD:B9:80:07:6E
ONBOOT=yes
HOTPLUG=no
DHCP_HOSTNAME=server.cec.com
IPADDR=192.168.0.10
NETMASK=255.255.255.0
TYPE=Ethernet
USERCTL=no
IPV6INIT=yes
PEERDNS=yes

Changed sysctl.conf - net.ipv4.ip_forward =1
[root@server etc]# sysctl -p
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

MASQUERADE eth0
[root@server etc]# iptables -L -n -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Changed dhcpd.conf to route internet at eth1 and set range
[root@server etc]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
DHCPARGS=eth1;
subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.0.10;
option subnet-mask 255.255.255.0;

option nis-domain "static.pldt.net";
option domain-name "static.pldt.net";
option domain-name-servers 58.69.254.3, 58.69.254.8;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.0.100 192.168.0.200;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server static.pldt.net;
hardware ethernet 1C:BD:B9:80:07:6E;
fixed-address 58.69.254.3, 58.69.254.8;
}
}
[root@server etc]#

But when I restart network i get the following
[root@server etc]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]
[root@server etc]#
[root@server etc]#

Disabling IPv4 packet forwarding
but i already changed it to 1 at sysctl.conf

One of the online forum says i need to configure the named.conf
deleted some and run it(named.conf) and successful but still when I run network service I still get the :
"Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0"

The network is getting the IP range but it doesnt get any Internet connection.

I'm a novice and any help will be greatly appreciated.

Thank you.
Your just added that line in the sysctl.conf but that is not loaded in the kernel, so after adding that line you have to run the command
Code:
sysctl -p
Then after the module will be loaded into the kernel and will work.
 
Old 11-22-2010, 12:04 PM   #4
blathori
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
Unhappy

Quote:
Originally Posted by divyashree View Post
Your just added that line in the sysctl.conf but that is not loaded in the kernel, so after adding that line you have to run the command
Code:
sysctl -p
Then after the module will be loaded into the kernel and will work.

Ok i have same problem, and i get the same messenge after doing the sysctl -p.
when service network restart it says:

Shutting down interface eth0: [ OK ]
Shutting down interface eth1: [ OK ]
Shutting down loopback interface: [ OK ]
Disabling IPv4 packet forwarding: net.ipv4.ip_forward = 0
[ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
Bringing up interface eth1: [ OK ]



And for sure i have change the
sysconf and make a echo 1 > ...ip_forward file


I really need internet on clients.
 
  


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
ipv4 forwarding problem..... surajpd Linux - Networking 6 12-02-2010 02:55 PM
activate ipv4 forwarding cccc Debian 3 10-31-2008 11:20 PM
net ipv4.ip_forward = 1 sabarinath Linux - Networking 1 05-02-2008 08:11 AM
nat not working, cannot change /proc/sys/net/ipv4/ip_forward 70k51k Linux - Networking 7 12-04-2006 11:16 AM
net.ipv4.ip_forward=1 How define it on boot ? sergiodemoura Linux - Newbie 5 12-04-2003 05:52 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:00 PM.

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