LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sharing internet (https://www.linuxquestions.org/questions/linux-newbie-8/sharing-internet-286556/)

shutuphuman 02-05-2005 09:23 AM

sharing internet
 
Hi, have have two machines, both with fedora core 3 on...
the network i want to set up looks as following...

internet --- ethernet based router ---- LINUX BOX1 ----- HUB ---- any other computer


the linux box 1 has two ethernet cards, one to connect to the internet which i can do no probs, and another to the hub.

the computers connected to the hub our fine they can see the linux box 1 fine, but they cant seem to share the internet with them. the ip config is shown below but i havnt a clue how ti make linuxbox1 share please help

linuxbox1 card 1 to router ..
ip 192.168.1.4
sub : 255.255.255.0
gateway 192.168.1.1
dns : 192.168.1.1
linuxbox1 card 2 to hub
ip 192.168.0.1
sub 255.255.255.0
gateway 192.168.1.4
dns 192.168.1.4

a computer to connecect to hub...
ip 192.168.0.32
sub 255.255.255.0
gateway 192.168.0.1
dns 192.168.0.1


top summersize, how do i share an internet connection on linux box 1

james.farrow 02-05-2005 09:55 AM

I have a similar setup, except my main linux box is the firewall and 'router' for the other pc's on the hub/switch.

http://projectfiles.com/firewall/

Its easy to use and edit.

shutuphuman 02-05-2005 10:03 AM

this isnt helpful it is just a fire wall???? i dont want one as yet i wanna beable to share my internet connect!

Infernal211283 02-05-2005 10:13 AM

Hi.

I was in that world of pain too until someone asked me if i had NAT on the external eth. card.
Do you have NAT enabled on your external eth card?

shutuphuman 02-05-2005 10:15 AM

ok i can answer you with this question...

whats NAT

hehe so thats a no what is it how do i enable it?


and thank you thank you thank you for respomding to my plee hehe

nazir 02-05-2005 10:16 AM

do something like that:
Code:

echo 1> /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.1.4 -s 192.168.0.32
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

where eth0 is linuxbox to router, eth1 - linuxbox to hub

shutuphuman 02-05-2005 10:21 AM

ok, il give it a try the first line works fine

but it complins about the command iptables
any clues?

TigerOC 02-05-2005 10:21 AM

You need to have ip-masquerading in place and iptables and then have a command to forward to the boxes behind or use a nat routing script to bring it up with the network. An example is MonMotha's script ;
http://monmotha.mplug.org/firewall/firewall/2.3/

nazir 02-05-2005 10:23 AM

install iptables package

Infernal211283 02-05-2005 10:27 AM

:)

I guess after nazirs tip you'll be fine, anyways, if you'd like to understand it a little bit more there are some pdf files about nat (masquerading).

if you'd like to basicaly secure your connection either you could use this pdf:

http://www.ibiblio.org/pub/Linux/doc...mple-HOWTO.pdf

i hope it'll help you as it helped me to get started with internet sharing.

Infernal211283 02-05-2005 10:28 AM

go through the pdf i gave you, you'll know what to do.

shutuphuman 02-05-2005 10:30 AM

well my machine apprently says its installed, i use yum it says nothing to do, i can even read the manual.

but no it hates me

nazir 02-05-2005 10:49 AM

try to find iptables, it should be somewhere in /usr/local/sbin or /usr/sbin, use it with path, and of course you must be root.. as root try this:
Code:

whereis iptables
in my os it shows:
Code:

iptables: /sbin/iptables /lib/iptables /usr/share/man/man8/iptables.8.bz2
it is in /sbin

then use it AS ROOT with path
fo example
Code:

echo 1> /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.1.4 -s 192.168.0.32
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT


shutuphuman 02-05-2005 11:21 AM

well hte cmmands are working fine now!!1

but unfortantly no hope of sharing the interenet as yet

more suggestions :-(?

nazir 02-05-2005 11:46 AM

maybe try to ping something from machine behind the nat


All times are GMT -5. The time now is 10:05 AM.