LinuxQuestions.org
Visit Jeremy's Blog.
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 06-09-2006, 03:04 PM   #1
70k51k
LQ Newbie
 
Registered: Jul 2003
Posts: 21

Rep: Reputation: 15
nat not working, cannot change /proc/sys/net/ipv4/ip_forward


I am using ubuntu server v5.10. I have followed their instructions at http://help.ubuntu.com/6.06/ubuntu/s...iguration.html without luck, I also tried the instructions at http://www.gentoo.org/doc/en/home-router-howto.xml. This website mentioned that I need to change /proc/sys/net/ipv4/ip_forward from a 0 to a 1 so the kernel knows forwarding is ok. I am unable to do this, if I try their little echo code, it tells me I do not have permission, and if I straight up try to "sudo vi" the document and change it myself, it says that the document has changed since I opened it up and gives me an fsync error. Anyone have any ideas? do I need to disable one of the interfaces before I try to make this change?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-09-2006, 03:52 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Have you tried sudo echo 1 > /proc/sys/net/ipv4/ip_forward - that should allow you to turn IP forwarding on. Make sure that no editors are open with /etc/sysctl.conf in them before running sudo vi /etc/sysctl.conf then you should be able to add the line net.ipv4.ip_forward = 1 (and any others).
 
Old 06-09-2006, 04:08 PM   #3
70k51k
LQ Newbie
 
Registered: Jul 2003
Posts: 21

Original Poster
Rep: Reputation: 15
Unhappy

I tried that, it ends up like this:

ben@ubuntu:~$ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
-bash: /proc/sys/net/ipv4/ip_forward: Permission denied

I thought that by using sudo, I wouldn't be denied access to anything, so I am thinking that maybe there is a program open that is using that document. When I type in ps -d, I get the following output.

PID TTY TIME CMD
1 ? 00:00:01 init
2 ? 00:00:00 ksoftirqd/0
3 ? 00:00:00 events/0
4 ? 00:00:00 khelper
5 ? 00:00:00 kthread
7 ? 00:00:00 kacpid
54 ? 00:00:00 kblockd/0
78 ? 00:00:00 pdflush
79 ? 00:00:00 pdflush
81 ? 00:00:00 aio/0
80 ? 00:00:00 kswapd0
666 ? 00:00:00 kseriod
1723 ? 00:00:00 khubd
2766 ? 00:00:00 kjournald
5295 tty1 00:00:00 bash
5448 ? 00:00:00 sshd
5460 pts/0 00:00:00 ps

Anything on there that looks like I need to kill? Even if I restart, before I do anything else, I am not able to edit that file.

Last edited by 70k51k; 06-09-2006 at 04:11 PM.
 
Old 06-09-2006, 04:23 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
How about su and then echo 1 > /proc/...?

Maybe sudo isn't configured correctly.
 
Old 06-10-2006, 03:12 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Unless you already have an editor open, it sounds like osor is correct in that sudo is probably configured incorrectly. There's nothing unusual about the list of processes you have - and nothing to suggest another editor is running.

Can you let us know whether using su works?
 
Old 06-10-2006, 07:34 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
You might also try
Code:
(sudo) sysctl -w net.ipv4.ip_forward=1
 
Old 06-12-2006, 10:37 AM   #7
70k51k
LQ Newbie
 
Registered: Jul 2003
Posts: 21

Original Poster
Rep: Reputation: 15
sudo was configured incorrectly. I enabled the root account, and tried the command while logged in as root, that fixed it. Thank y'all very much!
 
Old 12-04-2006, 10:16 AM   #8
Nevro
LQ Newbie
 
Registered: Dec 2006
Posts: 1

Rep: Reputation: 1
Actually, in
Code:
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
only "echo 1" part is run as root. "> file" is still interpreted by user's shell. One could use:
Code:
echo 1|sudo tee /proc/sys/net/ipv4/ip_forward
Or if you have access to shells from sudo:
Code:
sudo bash -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
 
2 members found this post helpful.
  


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
Can't create file using echo: /proc/sys/net/ipv4/ip_local_port_change rsumbeling Linux - General 4 07-17-2013 04:20 AM
/proc/sys/net doesn't exist. jimhawk Linux - Networking 1 03-15-2006 05:03 PM
/proc/sys/net/ipv4/ip_local_port_range wetwet Linux - Networking 0 07-06-2004 08:47 AM
net.ipv4.ip_forward=1 How define it on boot ? sergiodemoura Linux - Newbie 5 12-04-2003 04:52 AM
default values for /proc/sys/net/ipv4 robeb Linux - Networking 0 06-07-2002 12:35 AM

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

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