internet connection sharing
Hello.. I just got a new old box and I installed slackware linux 10 on it... I have a hardware modem and can connect to the internet and everything alright, but I want to be able to share that connection with a windows box that I have sitting next to it... can anyone help me do this?
I tried using google to search, and didn't find much, and what I did find kinda confused me.. any help is appreciated, thank you in advance for it. |
hardware: you'll need an ethernet card on each box, and either a crossover cable or two regular cables and a switch/hub...
software: basically it's just a matter of setting an iptables script in your /etc/rc.d/rc.firewall file... of course you'd need to have iptables installed before that... if you did a full install you already have it... you can check with: Code:
ls /var/log/packages | grep iptables you will be configuring your internet-connected box as a NAT router... the dial-up modem will be it's external interface and the ethernet card will be the internal interface... the windows machine will have one ethernet card and it will be connected with ethernet cabling to the internal ethernet card of the NAT box... the windows machine will use an internal IP such as 192.168.0.2, for example... the internal network card of the NAT box will also use an internal IP, such as 192.168.0.1, for example... the external interface (dial-up) will use whatever IP it gets from your ISP, as it normally does... the windows machine will be configured to use 192.168.0.1 (or whatever the NAT box's internal IP is) as it's gateway... the windows machine can use the same DNS servers that your NAT box uses (provided by your ISP) if you want... |
i wrote a very simple /etc/rc.d/rc.firewall iptables script for you that should do the trick once you have your network cards setup... all you'd have to do is save it as /etc/rc.d/rc.firewall and make it executable with a:
Code:
chmod 755 /etc/rc.d/rc.firewall Code:
#!/bin/sh |
ok.. I've gotten as far as setting up the network right.. but how do I use that script?
(I've never had experience with scripts before) |
just copy the script and save it as text file /etc/rc.d/rc.firewall and then make the file executable by doing a:
Code:
chmod 755 /etc/rc.d/rc.firewall after copying/chmod-ing it you can also execute it manually by issuing the command: Code:
/etc/rc.d/rc.firewall |
ok... when I dot hat it says..
"iptables: Table does not exist (do ou need to insmod?) iptables: Table does not exist (do ou need to insmod?)" |
post the output of these commands (after executing the script):
Code:
iptables -L Code:
iptables -t nat -L Code:
lsmod Code:
ifconfig |
heh, nevermind that last post, I figured out why it was doing that...
type-o on my part. |
so everything is working fine now?? you can surf the web (etc.) from the windows box??
|
hmm, no... it still isn't working..
I'm not getting any error or anything, I just can't connect to the internet from the windows box. I've tried to sign onto AIM on my windows box and that isn't working, and I've tried pinging a website and that isn't working. |
|
hmm, this is difficult.. I'm doing this from the linux machine so I'm using links and I can't figure out how to copy and paste the results of those commands into this. I can ping the windows machine from here and I can ping this machine from the windows one. though.
|
can you ping 64.233.187.99 or 64.233.187.104 from the windows machine??
|
your IP configuration should look like this:
linux box: ppp0 = whatever your ISP gives you eth0 = 192.168.0.1 (netmask 255.255.255.0) windows box: IP = 192.168.0.2 netmask = 255.255.255.0 gateway = 192.168.0.1 |
hmm.. I definately just restarted the windows machine and it's working fine now. I probably should have tried that a while ago.
cool, I'm glad I have this working.. thank you for the help |
you're very welcome!! let me know if any issues come-up... good luck!!
|
hmm.. kinda an issue, not that big of one I guess....
but pre this, I had apache set up, as well as proftpd and they worked fine... now they aren't working.. is it related, or did I change something without realizing it ? ssh also isn't working...... which is more of an issue than anything... I planned on using that mostly when I needed to do anything with the machine. |
you mean, like, to access those services on your box from the internet??
|
well, yeah, or the local network.. from the windows machine..
and when I try to connect with ssh, it just times out. same with http |
Quote:
Quote:
here you go (the relevant rules are in bold): here you go: Code:
#!/bin/sh |
ok, so if I need a port opened for whatever reason, it's just like those added lines, only change the port number?
|
yeah, basically... but it wouldn't be a bad idea to do some reading about iptables/netfilter so you can have a better understanding of what the script is doing:
http://www.linuxguruz.com/iptables/howto/ http://www.linuxguruz.com/iptables/ http://www.justlinux.com/nhf/Securit...es_Basics.html http://iptables-tutorial.frozentux.n...-tutorial.html for more iptables info: http://www.google.com/linux?hl=en&lr...es&btnG=Search ;-) |
BTW, that script is logging every packet that gets blocked by the firewall... you can see what packets are getting blocked in "real-time" by doing a:
Code:
tail -f /var/log/syslog this is good for troubleshooting and stuff... like, for example when you weren't able to SSH to the box - by monitoring the log file you would have noticed the port 22 packets getting blocked... so you would have known it was a firewall issue right away... it's also good for seeing all the weird spiders that crawl all over the internet... hehe... |
All times are GMT -5. The time now is 11:45 AM. |