LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Two computers need to connect to the net through a third one. (https://www.linuxquestions.org/questions/linux-networking-3/two-computers-need-to-connect-to-the-net-through-a-third-one-368615/)

dalek 09-30-2005 10:21 PM

Two computers need to connect to the net through a third one.
 
Here is the deal, again. I always start out that way. LOL Anyway, I just got another old Proliant 6000 rig with a ethernet card. I have onther compuer that sits in the closet and runs folding. I plan to run folding on the Proliant too. All that comes through my main rig. Some thing like this:

Code:

putput  >>  |
                  |
                  | >>>>>>>> smoker.net >>>  dial-up modem  >>> internet
                  |
                  |
pokey.net >

Naturally putput and pokey.net are connected by ethernet cable. IP address:

putput 192.167.0.2

pokey.net 192.168.0.5

Smoker.net has two networks cards so it has two numbers, I guess that is right. :scratch:

eth0 192.168.0.1 for pokey connection

eth1 192.167.0.1 for putput connection

I used to could get pokey.net to connect to the net by running this little script:

Code:

#!/bin/bash
 IPTABLES='/sbin/iptables'
# Set interface values
 EXTIF='ppp0'
 INTIF1='eth1'
 INTIF2='eth2'
 
# enable ip forwarding in the kernel
 /bin/echo 1 > /proc/sys/net/ipv4/ip_forward
# flush rules and delete chains
 $IPTABLES -F
 $IPTABLES -X
# enable masquerading to allow LAN internet access
 $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
# forward LAN traffic from $INTIF1 to Internet interface $EXTIF
 $IPTABLES -A FORWARD -i $INTIF1 -o $EXTIF -m state --state
NEW,ESTABLISHED -j ACCEPT
# forward LAN traffic from $INTIF2 to Internet interface $EXTIF
 $IPTABLES -A FORWARD -i $INTIF2 -o $EXTIF -m state --state
#NEW,ESTABLISHED -j ACCEPT
 #echo -e "      - Allowing access to the SSH server"
 $IPTABLES -A INPUT --protocol ssh --dport 22 -j ACCEPT
 #echo -e "      - Allowing access to the HTTP server"
 $IPTABLES -A INPUT --protocol tcp --dport 80 -j ACCEPT
# block out all other Internet access on $EXTIF
 $IPTABLES -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP
 $IPTABLES -A FORWARD -i $EXTIF -m state --state NEW,INVALID -j DROP

Since I hooked the second card, it doesn't work anymore either.

This may be info overload here but I'm going to post all the info I can think of. First is smoker.net, my main rig that I connect to the net with through a modem:

Code:

root@smoker / # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:53:81:00:E7
          inet addr:192.168.0.1  Bcast:192.168.0.25  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:643 errors:0 dropped:0 overruns:0 frame:0
          TX packets:980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:102744 (100.3 Kb)  TX bytes:88724 (86.6 Kb)
          Interrupt:10 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3233 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3233 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:229234 (223.8 Kb)  TX bytes:229234 (223.8 Kb)

ppp0      Link encap:Point-to-Point Protocol
          inet addr:205.208.159.72  P-t-P:205.208.156.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:405 errors:2 dropped:0 overruns:0 frame:0
          TX packets:466 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:76011 (74.2 Kb)  TX bytes:60593 (59.1 Kb)

root@smoker / # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
JacksonMS.TNT.0 *              255.255.255.255 UH    0      0        0 ppp0
192.168.0.0    *              255.255.255.0  U    0      0        0 eth0
loopback        localhost      255.0.0.0      UG    0      0        0 lo
default        JacksonMS.TNT.0 0.0.0.0        UG    0      0        0 ppp0
root@smoker / #

Same thing for pokey.net:

Code:

pokey ~ # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:01:53:80:DC:35
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2078 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1762 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:208802 (203.9 Kb)  TX bytes:329530 (321.8 Kb)
          Interrupt:11 Base address:0xde00

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

pokey ~ # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.0.0    *              255.255.255.0  U    0      0        0 eth0
loopback        localhost      255.0.0.0      UG    0      0        0 lo
default        smoker.net      0.0.0.0        UG    0      0        0 eth0
pokey ~ #

This is for putput:

Code:

putput root # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:08:C7:28:12:00
          inet addr:192.167.0.2  Bcast:192.167.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3376 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2217 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:307012 (299.8 Kb)  TX bytes:334756 (326.9 Kb)
          Interrupt:10 Base address:0x4000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6032 (5.8 Kb)  TX bytes:6032 (5.8 Kb)

putput root # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.167.0.0    *              255.255.255.0  U    0      0        0 eth0
loopback        localhost      255.0.0.0      UG    0      0        0 lo
putput root #

If you have a better way to set this up and want to help me a bit, let me know. I just want something that works and works well. I have iptables installed as well and use a 2.6 kernel if that matters.

Any, I do mean any, help would be appreciated. This is for folding by the way.

Thanks

:D :D :D :D

dalek 09-30-2005 10:39 PM

Oh, I forgot to mention that putput can ping smoker and pokey.net can ping smoker.net as well. I can also ssh into both pokey.net and putput from smoker.net. The cards and all work, I just need it to connect to the net.

Thanks

:D :D :D

shuuhen 10-01-2005 12:38 AM

The first problem I see is the script uses eth1 and eth2 for the internal networks, but I don't see either in the ifconfig output from smoker. It looks like you just need to modify the script to use eth0 and whatever the second NIC is registered as on the machine.

dalek 10-01-2005 01:04 AM

OK. I added this to the script and made it look like this:

Code:

# Set interface values
 EXTIF='ppp0'
 INTIF0='eth0'
 INTIF1='eth1'
 INTIF2='eth2'
 INTIF3='eth3'

Now I can connect to the net with pokey.net but putput does not. This is what I get from putput when I try to fetch foldingathome:

Code:

putput root # emerge -f foldingathome
Calculating dependencies ...done!
>>> emerge (1 of 1) sci-biology/foldingathome-5.0.2-r3 to /
>>> Downloading http://www.stanford.edu/group/pandeg...H502-Linux.exe
--18:30:59--  http://www.stanford.edu/group/pandeg...H502-Linux.exe
          => `/usr/portage/distfiles/FAH502-Linux.exe'
Resolving www.stanford.edu... failed: Temporary failure in name resolution.
!!! Couldn't download FAH502-Linux.exe. Aborting.

!!! Fetch for /usr/portage/sci-biology/foldingathome/foldingathome-5.0.2-r3.ebuild failed, continuing...



!!! Some fetch errors were encountered.  Please see above for details.


putput root #

I did copy resolv.conf over from smoker to putput just like I did for pokey.net. It seems that I can talk to it but it does not know how to get from the ethernet card to my modem or something. Is it a route command that I need or something to do with the tables thing?

In case you can't tell, I'm not real good at networking, yet. I need to go get a book and read up on it but they seem to sail over my head because I don't do a lot of networking. I'm not even going to try wireless yet. :tisk:

I did notice a difference between the return of route on putput and pokey though. This is pokey:

Code:

pokey ~ # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.168.0.0    *              255.255.255.0  U    0      0        0 eth0
loopback        localhost      255.0.0.0      UG    0      0        0 lo
default        smoker.net      0.0.0.0        UG    0      0        0 eth0
pokey ~ #

This is putput:

Code:

putput root # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
192.167.0.0    *              255.255.255.0  U    0      0        0 eth0
loopback        localhost      255.0.0.0      UG    0      0        0 lo
putput root #

One is missing on putput. How do I add that? I have tried different route commands but all I get is a error. That man page looks like greek too. O_O

Thanks for the help. I need it. Oh, my ISP blocks all pings. I am limited to using emerge to try to fetch foldingathome to test it. :cry:

:D :D :D :D

I hope this post looks OK. I did it all by hand in a quick reply. :scratch:

dalek 10-01-2005 01:16 AM

Wooooooo Hooooooooooo!!!!!!!! I got it working. For those searching for a fix, here is what I typed in:

Code:

putput root # route add default gw 192.167.0.1
I think it tells it to look to 192.167.0.1 for the net. I typed that in on putput, the machine trying to get through smoker to the net.

Thanks for the help. You got me started for sure. I was reading the man page when the bulb went off. I sort of think I understand it anyway. I plan to sync, then install folding and let her rip. She's slow but it works anyway. Might take a couple weeks for it to finish a unit thing.

Thanks again.

:D :D :D


All times are GMT -5. The time now is 06:14 PM.