Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 03-23-2005, 05:54 PM   #1
LQ Newbie
Registered: Oct 2004
Distribution: Debian
Posts: 23

Rep: Reputation: 15
lost rc.ip_forward

Hey guys,

I did something really stupid and lost my rc.ip_forward script. Is there an easy way to recover it? Some place to download the default?

Old 03-23-2005, 06:13 PM   #2
Registered: Jan 2005
Distribution: Slackware current (and others)
Posts: 188

Rep: Reputation: 30
# /etc/rc.d/rc.ip_forward: start/stop IP packet forwarding
# # If you intend to run your Linux box as a router, i.e. as a
# computer that forwards and redistributes network packets, you
# will need to enable IP packet forwarding in your kernel. #
# To activate IP packet forwarding at boot time, make this
# script executable: chmod 755 /etc/rc.d/rc.ip_forward #
# To disable IP packet forwarding at boot time, make this
# script non-executable: chmod 644 /etc/rc.d/rc.ip_forward
# Start IP packet forwarding:
ip_forward_start() { if [ -f /proc/sys/net/ipv4/ip_forward ]; then
echo "Activating IPv4 packet forwarding."
echo 1 > /proc/sys/net/ipv4/ip_forward fi
# When using IPv4 packet forwarding, you will also get the
# rp_filter, which automatically rejects incoming packets if the # routing table entry for their source address doesn't match the
# network interface they're arriving on. This has security
# advantages because it prevents the so-called IP spoofing, # however it can pose problems if you use asymmetric routing
# (packets from you to a host take a different path than packets
# from that host to you) or if you operate a non-routing host # which has several IP addresses on different interfaces. To
# turn rp_filter off, uncomment the lines below:
#if [ -r /proc/sys/net/ipv4/conf/all/rp_filter ]; then # echo "Disabling rp_filter."
# echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
#fi }

# Stop IP packet forwarding: ip_forward_stop() {
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
echo "Disabling IPv4 packet forwarding."
echo 0 > /proc/sys/net/ipv4/ip_forward

# Restart IP packet forwarding:
ip_forward_restart() {
sleep 1

case "$1" in
echo "usage $0 start|stop|restart"
Old 03-23-2005, 06:18 PM   #3
LQ Newbie
Registered: Oct 2004
Distribution: Debian
Posts: 23

Original Poster
Rep: Reputation: 15
You rock!

Thanks so much!
Old 03-23-2005, 06:34 PM   #4
LQ Newbie
Registered: Oct 2004
Distribution: Debian
Posts: 23

Original Poster
Rep: Reputation: 15
I got an error when I tried to run that, but it was pretty simple to fix. The "ip_forward_stop() {" is commented out, so the "}" is unexpected. I just had to move the ip_forward_stop to a new line. I do have a question though. What is the "fi" at the end of the start and stop routines, and why isn't it included at the end of the restart routine?

Thanks again
Old 03-23-2005, 07:00 PM   #5
Senior Member
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
"fi" is the ending of a "if" block.
Old 03-24-2005, 04:32 PM   #6
Registered: Mar 2004
Location: VA
Distribution: Slackware 10.0
Posts: 50

Rep: Reputation: 15
I think you can disable ip_forward service unless you are using your linux box as a router.


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
Tracking changes to the ip_forward variable gauge73 Linux - Networking 1 08-21-2005 02:51 PM
ip_forward mikz Slackware 2 02-01-2005 04:49 AM
how to set ip_forward on at startup? enjoyzj Linux - Networking 4 04-16-2004 10:56 AM
IP_Forward Neur0tek Linux - Newbie 9 05-09-2002 09:44 AM
ip_forward Sathe Linux - Networking 2 10-19-2001 12:53 AM

All times are GMT -5. The time now is 11:25 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration