LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   linux gateway help (https://www.linuxquestions.org/questions/linux-networking-3/linux-gateway-help-274598/)

eantoranz 01-06-2005 01:10 PM

OK... let's start all over again at the firewall level.

Can you flush all (I mean ALL) the rules from the firewall so we can set this thing up?

Hitty 01-06-2005 01:12 PM

how do i do that?

eantoranz 01-06-2005 01:20 PM

Sounds like you can. ;)

Flushing:
Code:

iptables -F
iptables -t nat -F

policys (I'll accept everything from everywhere for this experiment)
Code:

iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

Let's enable masquerading:
Code:

iptables -t nat -A POSTROUTING -j MASQUERADE
let's enable forwarding
Code:

echo 1 > /proc/sys/net/ipv4/ip_forward
From this moment on, whatever packet goes out from your linux box, it will have as the source address the linux box itself (doesn't matter if the packet was originally sent from another box). That means, if one packet arrived at the linux box but was meant to go to another computer, the linux box will forward it to the right computer it was meant to BUT it will have as the source the linux box itself, so packets go back to it (and it will forward the replys to the right computer it was meant to also).

Hope that works.

Hitty 01-06-2005 01:24 PM

I tried that, but i got an error on the last part


hitetsu@WhiteNinj4:~ $ sudo echo 1 > /proc/sys/net/ipv4/ip_forward
bash: /proc/sys/net/ipv4/ip_forward: Permission denied

eantoranz 01-06-2005 01:29 PM

??? try logging in as root. (I know sudo does that... but it seems to be failing).
login as root and send the command.

Hitty 01-06-2005 01:29 PM

i cant log in as root, it doesnt seem to let me

username: root
password: [none]

i tried, using my password aswell, but it still didnt work

eantoranz 01-06-2005 01:32 PM

:O

Do you know how to recover from this situation? I know how, in case you don't... but it requires restarting with another linux (probably KNOPPIX or another live-cd).

Hitty 01-06-2005 01:33 PM

no idea =/

i got a SuSE 9.2 live cd...that good enough?

masand 01-06-2005 01:36 PM

post the O/P of

ifconfig

regards

eantoranz 01-06-2005 01:39 PM

I guess so. You have to start a session (not the installation, but a session.. a terminal) as root, mount the partition where you have the /etc of your working linux, edit the /etc/passwd file (of the working linux... not the CD) (with vi, probably) and remove the x after root:.

That way, when you start your working linux, and log in as root, it will have no password.

Hitty 01-06-2005 01:51 PM

how do i mount the drive and edit the file?

[edit] i couldnt run ifconfig with the live cd in[/edit]

eantoranz 01-06-2005 01:54 PM

with mount.

For example:

Code:

mkdir /mnt/tmp
mount /dev/hda6 /mnt/tmp -o rw

Then you have the partition hda6 mounted in /mnt/tmp.

Emerson 01-06-2005 06:11 PM

Cant he start up his Ubuntu in single user mode? And change the password in an easy way?

eantoranz 01-07-2005 08:27 AM

mmmmmmmmm........... well... now that you are saying that, I can remember that when I start my mandrake in single user mode, it doesn't even ask for my password... so I think that's a possibility.

Emerson 01-07-2005 09:21 AM

Debian will ask root pw unless you pass 'init=/bin/bash' to kernel. Hmmm, not sure about exact syntax, my personal RAM may be errenous...

EDIT

Just gave it a try. With GRUB:

press e, select kernel command line with arrow down, press e again, add 'single init=/bin/bash', press Enter, press b to boot. And volila! - you are in as root. Changing password is a piece of cake! I love LQ, every time I learn something myself.


All times are GMT -5. The time now is 07:58 PM.