Forum Moderators: bakedjake

Message Too Old, No Replies

Need help networking/router Linux, Windows Xp with 2 IP addresses

Linux, Windows Xp, 2 IP

         

mikejson

12:55 am on Jul 20, 2003 (gmt 0)

10+ Year Member



Ok I'm trying to use my Linux box as a router+server. Currently I'm running RH9. But I am completely new to Linux. First install was 3 days ago. I have it running the http/apache stuff. The default page appears, and I've made my own index.html file as well. But I want to have my Linux box route for my interenet connections. My Linux Box has 2 NIC's now(1 to the internet line, which is cable, the other to my Windows Xp computer). I have looked on the net and I think I know what I have to do, but I don't know how to do it.

I think I have to first set up access to the web with my Linux box(which is done), then I have to determine which gateway/IP my Linux box is using, and use an IP like 198.172.0.1 or something for the windows comp IP.... I should have the same gateway as my Linux box or something like that.

I haven't found clear instructions on what I have to do. Could anyone point me to a page that has clear instructions OR give a brief but clear instruction on how to do this here?

I would rate my computer knowledge overall as decent. Linux is pretty hazy for me. I went over it once in school but have yet to do anything with it til 3 days ago, so I forget alot.

Any help would be greatful

Thanks
Mike :)

bcc1234

1:55 am on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have an external cable router?

mikejson

11:44 am on Jul 20, 2003 (gmt 0)

10+ Year Member



Ok this is my exact set up.
Modem---->Linuxbox----->WindowsXpbox

Internet connection comesfrom the modem, into 1 NIC in the linux box, then the linux box has a second NIC with a crossover cable to the Windows Box. That's it.

Now I know you can do this, I've heard it being done before, I just don't know the steps to take to do it.

Any help would be great
Mike

jpjones

12:03 pm on Jul 20, 2003 (gmt 0)

10+ Year Member



Yup, it's possible. It's the setup I'm surfing on right now (ablit an older version of RedHat).

To get you started, try a google for "redhat 9 masq", redhat 9 masquerade"

A quick search myself resulted in http*//docs.myjabber.net/howto/ip-Tables.htm which might be of use to you.

In short, you need to set up the Linux box to masquerade (so your internal IP address of the Windows XP box remains hidden), and turn on IP forwarding on the Linux box so it relay packets from one network card to the other.
(

echo 1 >/proc/sys/net/ipv4/ip_forward
does that)

HTH,
JP

mikejson

8:04 pm on Jul 20, 2003 (gmt 0)

10+ Year Member



Ah... I read something about that Masq stuff... didn't know for sure if that's what I needed or not.

Thanks, any other tips from anyone would be appreciated.

bcc1234

8:24 pm on Jul 20, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using a hardware router inside the modem then you just need to configure the linux box as a bridge and assign an ip to one of the nics. If not, then you need to set up nat.

mikejson

1:25 am on Jul 21, 2003 (gmt 0)

10+ Year Member



What is Nat exactly? I'm still learning/feeling my way around Linux....

bcc1234

1:57 am on Jul 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's network address translation. There are tons of info about hooking up cable to a linux box.
Search for something like "linux cable modem howto".
Just find out if your modem also does routing so you won't have to waste time setting it up on the box itself.

mikejson

2:48 am on Jul 21, 2003 (gmt 0)

10+ Year Member



Hmm... I wonder if my modem does routing. Either way, I have been looking through webbys.

I have come up with this type of configuration... I think I"m still missing something

rc.local has these entries

touch /var/lock/subsys/local

ifconfig eth1 192.168.1.1
echo"1">/proc/sys/net/ipv4/ip_forward
modprobeiptable_nat
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to 192.168.1.1
iptables -t nat -A POSTROUTING -S 192.168.1.2/32 -j MASQUERADE
iptables -A PREROUTING -t nat -p tcp --dport 4662 -j DNAT --to-destination 192.168.1.2

//end of rc.local

NOw my windows box is set up to have
Gateway 192.168.1.1
IP 192.168.1.2
DNS(the one my ISP auto assigns to windows before I did all this messing around)

Now I can ping back and forth... so they are connected via the cross-over on eth1 to win box.

But the win box can't see outside of the net, obviously my settings are flawed in there. I am new to linux, but not new to computers and setting up rules and such...

I wouldn't mind getting this up and running for tomorrow so I can telnet into both from work and play around with stuff :P

Anyway, thanks for the help so far, more is definitly welcome.

Thanks

bcc1234

2:49 am on Jul 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your modem does routing then you need to set up a bridge on the linux box and have your modem at 192.168.1.1
Both your boxes should have .1 as the gateway.

mikejson

1:56 am on Jul 21, 2003 (gmt 0)

10+ Year Member



Ok maybe this is a better way to describe this questions. (now that I read and learnt a fair bit about how linux works)

I have 2 IP's that I get from my cable ISP. I would like to use my Linux box as a router for one of the IPs. Basically have my Linux box use one IP and my windows box running from my linux use the other.

I know you can Masqurate(sp error hehe) a private IP to my Windows box, and run them both off the same IP but my Linux box would route the proper packets to my Windows box. But I was wondering if I can use both the IPs since I do get them for the price of 1.

Everything that I've found so far is just the NAT or MASQ. Which in essence is really only using 1 IP and creating private IPs for the rest of the network.

Anyone have any ideas?

bcc1234

9:19 am on Jul 22, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you happen to catch the word BRIDGE I mentioned twice already?