LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-02-2004, 01:57 PM   #1
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
problems with internet sharing w/ slack


I just installed Slackware 10.0 and I installed two Ethernet cards on the computer. I got eth0 to connect to the Internet and eth1 (192.168.0.1) to connect with my laptop. I searched around the Internet reading guides to setting it up and I tried using rc.ip_forward but my laptop won't connect to the internet.

I'm using this script:
Code:
    echo "1" > /proc/sys/net/ipv4/ip_dynaddr
   iptables -F
   iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
   iptables -A INPUT -i ppp0 --source 192.168.1.0/24 -j DROP
   iptables -A INPUT -i ppp0 --source 10.0.0.0/8 -j DROP
   iptables -A INPUT -i ppp0 --source 172.16.0.0/12 -j DROP
   iptables -A FORWARD -i eth0 -j ACCEPT
   iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
   iptables -A FORWARD -m limit --limit 5/minute --limit-burst 5
The scripts loaded from rc.local too.

THanks in advnaced
 
Old 09-02-2004, 02:37 PM   #2
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
I would do this using routes.

First on your laptop you need to set the default gateway to your Slackware box (192.168.0.1) with the command:
Code:
/sbin/route add default gw 192.168.0.1
Now on your slackware box (the one that has two NIC) you need to run:

Code:
/sbin/route add -net <Labtops IP> dev eth1
echo 1 > /proc/sys/net/ipv4/ip_forward
That should start making your Slackware box forwarding the packets for your laptop onto your laptop and by setting the laptop's default gateway to your slackware box the packets from the laptop will go though the slackware box and out to the Internet.... (Like a router)

I hope that helps and work... Post back with results!

Andrew

---


Andrew nrd.
 
Old 09-02-2004, 02:53 PM   #3
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
I tried using
Code:
route add -net 192.168.0.2 dev eth1
but i get a message saying
Quote:
SIOCADDRT: Invalid argument
I typed "route" in and got 3 destinations but I have no idea what they are:
localnet (on eth1), internet gateway IP on eth0, and loopback

Last edited by m3gz; 09-02-2004 at 02:57 PM.
 
Old 09-02-2004, 03:18 PM   #4
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
Those 3 routes are fine and should be there...

Try issuing this:

route add -net 192.168.0.2 netmask 255.255.255.0 dev eth1

andrew
 
Old 09-02-2004, 03:55 PM   #5
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
I tried adding:
Code:
route add -net 192.168.0.2 netmask 255.255.255.0 dev eth1
but i got an error
Quote:
netmask doesn't match route address
so i just used
Code:
route add -net 192.168.0.0 netmask 255.255.255.0 dev eth1
and that seems to work but then the IP forwarding still doesn't work.
Thanks for trying, but do you have any other suggestions?
 
Old 09-02-2004, 04:20 PM   #6
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
Can you give me the output of route -n?

Thanks
 
Old 09-02-2004, 04:26 PM   #7
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
Is IP forwding enabled? Did you do echo 1 > /proc/sys/net/ipv4/ip_forward?

You have to do that each time the computer boots up. Its easy to add:

FORWARD_IPV4 = YES

to: /etc/sysconfig/network

Andrew
 
Old 09-02-2004, 04:35 PM   #8
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
destinationּּּּgatewayּּּּּּּּgenmaskּּּּּּּּּּflagsּmetricּrefּuseּiface
192.168.0.0ּּּ0.0.0.0ּּּּּּּּּּּ255.255.255.0ּUּ0ּ0ּ0ּeth1
24.112.138.0ּ0.0.0.0ּּּּּּּּּּּ255.255.254.0ּUּ0ּ0ּ0ּeth0
127.0.0.0ּּּּּּּ0.0.0.0ּּּּּּּּּּּ255.0.0.0ּּּּּּּּּUּ0ּ0ּ0ּlo
0.0.0.0.0ּּּּּּּּ24.112.138.1ּ0.0.0.0ּּּּּּּּּּּּּUGּ0ּ0ּ0 eth0

i'm sorry if the spacing is messed up, i tried to do seomthing about it
 
Old 09-02-2004, 04:37 PM   #9
mermxx
Member
 
Registered: Apr 2004
Location: Wales
Distribution: rh9, winxp
Posts: 411

Rep: Reputation: 30
ok so ur slackware box is acting as ur server for the internet and ur laptop is wanting to share this connection so the ip addy of ur slackware is also ur gateway and dns server, so try adding the addy of that to your laptop in /etc/resolv.conf
nameserver 192.168.0.1

in your network device control in both machines u can try statically assigning addresses
192.168.0.1
subnet 255.255.255.0 (for ur server)
in a terminal window in each machine try pinging the other and make sure u can `see` each other if so then in reality u should be able to `surf` on both machines
and
192.168.0.2
subnet 255.255.255.0
gateway 192.168.0.1 (for ur laptop)

see how that goes any probs post back :-) (I am not sure what ur set up is to connect to the internet adsl/modem/router or cable) but that`s the basics of it
 
Old 09-02-2004, 04:43 PM   #10
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
Re NLR:
ip_forwarding starts on startup and i don't have the directory "sysconfig" in /etc so i can't do anything in /etc/sysconfig/network

re mermxx:
my laptop is set to:
IP: 192.168.0.2
subnet: 255.255.255.0
gateway: 192.168.0.1
dns is set to the IPs my ISP gave me

I am able to ping the machines but the Internet isn't being shared
 
Old 09-02-2004, 04:44 PM   #11
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
mermxx, when a packet is going to the labtop dose the slackware box need to have a route set up so that is packet get sent to the labtop?

Andrew
 
Old 09-02-2004, 05:04 PM   #12
mermxx
Member
 
Registered: Apr 2004
Location: Wales
Distribution: rh9, winxp
Posts: 411

Rep: Reputation: 30
it`s very late here and have to be up for work in the morning but am giving u a link which will answer ur question :-)
http://www.cisco.com/warp/public/105/21.html
will post tomorrow if u r still no further on :-)
 
Old 09-02-2004, 05:20 PM   #13
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
So if IP_FOWARDING is on, it will atomically route the packet? I still don't get why you don't have to set up a route, otherwise the kernel dose not know which NIC to send it on...

Andrew
 
Old 09-02-2004, 05:23 PM   #14
m3gz
LQ Newbie
 
Registered: Sep 2004
Location: Woodbridge
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
*laughs*
You guys lost me. I guess I lost you guys too, I thought it would be easy to do this, I guess I took linux too lightly. I'm just too used to Windows with that Internet sharing button.

i tried to do tracert/traceroute on an IP and it does go to the gateway (192.168.0.1) but my nix box doesn't do anything from there. IP forwarding should be on on boot.

Oh and I'm connected on cable through eth0. I know the internet is working because I used lynx and ftp.
 
Old 09-02-2004, 05:38 PM   #15
NLR
Member
 
Registered: Jun 2004
Posts: 103

Rep: Reputation: 15
OK so we know your labtop works fine is correct set up, but the main box is not fowarding... We you posted route -n it did not have the route in there so try this one more time...

route add -net 192.168.0.2 netmask 255.255.255.0 dev eth1

Andrew
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet connection sharing problems Gitzo645 Mandriva 5 01-24-2005 04:00 AM
internet sharing from slack 10.0 -> win xp zobra Linux - Networking 4 11-20-2004 12:17 AM
Problems -Internet sharing Mandrake & XP Hamid_Son Linux - Networking 0 06-16-2004 04:43 AM
Internet Connection Sharing Problems gbrad Linux - Networking 6 09-18-2003 12:28 PM
Internet Connection Sharing Problems... Artimus Linux - Networking 6 04-28-2003 09:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration