internet sharing, SUSE/ WinXP

_SunTzu_

Distinguished
Apr 5, 2006
99
0
18,630
Since i moved to linux 3 days ago, and i'm in this completely new ground, and now i'm faced with a stupid problem:
I am trying to make SUSE 10.1 become the gateway for my WinXP laptop using Ethernet cards, i was successful in creating a network connection between both PCs, but on SUSE, the stupid thing is that i am not able to make both NICs (eth0 and eth1) work simultaneously, coz whenever one is working, the other just shuts down. check below for the snapshot, the "X" mark next to the VIA (eth0) means that this is the NIC that is enabled, if i click on eth1, the "X" moves next to it and other shuts down, and so will my internet connection.

snapshot19hm.png
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
Unfortunately, this type of setup is a bit tricky to setup if you're not too terribly familiar with how Linux does things.
Fortunately, however, there's a fairly clear SuSE-specific guide to do just that here
Don't hesitate to ask any other questions you might have.
 

_SunTzu_

Distinguished
Apr 5, 2006
99
0
18,630
hmm... i tried the link u gave me, is very comprehensive and wel lwritten, but in my case, i do not use a router or a switch, i'm only connecting 2 PCs, is it feasible without burying a router? I understood from surfing numerous forums that 10.1 can do that, except how?
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
If it's just between 2 computers, when it says

Modem--SuSE Machine External Card--SuSE Machine Internal Card--Switch/Hub--Other Machine

Just remove the switch and hook up the internal card directly to the other machine

Modem--SuSE Machine External Card--SuSE Machine Internal Card--Other Machine

update
But hold on just a bit, I'm going to try to setup a tool to help set all this malarky up, it very well could make the whole process really painless if it installs easilty enough.. stay tuned.
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
Ok, this looks promising, but I haven't fully tested it, so here goes:

First, start up the YaST software installer, search for dhcp-server, install. (this just makes things easier, not strictly necessary but allows for further expansion too). If you no longer have the install discs, you can add an online repository source like so:

YaST->Software->Installation Source->Add...->HTTP->download.opensuse.org in the name ->
/distribution/SL-10.1/inst-source/ in the directory ->Accept->wait while it adds it.

Once dhcp-server (dhcpd) is installed, download the firestarter firewall RPM from here . Open a terminal, become root (su then the root password), navigate to where you saved the rpm, type "rpm -Uvh firestarter[tab][enter]", the tab will complete the rest of the filename (this is a nice feature called tab completion, try it out if you don't already know about it). It should install without issue and put an icon in the SuSE main menu, start it up and set 'er up.

For setup info, go to the Firestarter documentation. hope this works well for you.
 

linux_0

Splendid
Ok, this looks promising, but I haven't fully tested it, so here goes:

First, start up the YaST software installer, search for dhcp-server, install. (this just makes things easier, not strictly necessary but allows for further expansion too). If you no longer have the install discs, you can add an online repository source like so:

YaST->Software->Installation Source->Add...->HTTP->download.opensuse.org in the name ->
/distribution/SL-10.1/inst-source/ in the directory ->Accept->wait while it adds it.

Once dhcp-server (dhcpd) is installed, download the firestarter firewall RPM from here . Open a terminal, become root (su then the root password), navigate to where you saved the rpm, type "rpm -Uvh firestarter[tab][enter]", the tab will complete the rest of the filename (this is a nice feature called tab completion, try it out if you don't already know about it). It should install without issue and put an icon in the SuSE main menu, start it up and set 'er up.

For setup info, go to the Firestarter documentation. hope this works well for you.



Or you could do this:

[code:1:2914067add]
#!/bin/sh
echo "1" > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A PREROUTING -d 1.2.3.4 -i eth1 -j DNAT --to-destination 192.168.0.2
iptables -t nat -A POSTROUTING -s 192.168.0.1 -o eth1 -j SNAT --to-source 1.2.3.4
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT -o eth1 --to-source 1.2.3.4
iptables -A FORWARD -p tcp -i eth0 -o eth1 -d 192.168.0.1 -m multiport --dport 80,443,53,22 -m state --state NEW -j ACCEPT
iptables -A FORWARD -t filter -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -o eth1 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -t filter -i eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
[/code:1:2914067add]

Save this to /etc/init.d/routing

chmod a+rx /etc/init.d/routing

/etc/init.d/routing

Where 1.2.3.4 is your public IP address and 192.168.0.0/24 is your private subnet

:-D