Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...it was ingeniously designed and all those clicks were for my own good... and that was even before I got my speedy and useful answer to my tekkie question that I eventually posted..."

Geography

Where in the world do Tek-Tips members come from?
JoBlink (TechnicalUser)
1 Mar 12 15:26
HI!  I have a laptop running Ubuntu 8.04 server - command line.
This laptop has 2 network interfaces: USB and RJ45

I'm trying to share internet connection and have it work as router
It pings internet sites through USB, but unable to ping anything on LAN through RJ-45, i.e 192.168.0.1 - "Destination host unreachable"
Please look at my interface setup and tell me if there is a mistake:
I'm not talking about masquerading and ipforward- that is the next step :)
THANKS FOR READING !


INTERNET
CABLE MODEM
|
|
LAPTOP SERVER
auto eth2
# in the line bolow changed # in the line bolow changed 'static' to 'dhcp'
iface eth2 inet static
address 68.37.138.1
netmask 255.255.252.0
gateway 68.37.137.1
|
|
iface eth0 inet static
address 192.168.0.202
netmask 255.255.255.0
network 192.168.0.0

#TRIED these settings ,but failed:
#address 192.168.10.1
#netmask 255.255.254.0
#gateway 68.37.137.1

|
|
ROUTER    
WAN        
IP Addr:68.37.138.1
Subnet  255.255.252.0
Gateway 68.37.137.1
|
|
LAN
IP Addr:192.168.0.1
Subnet  255.255.255.0
DHCP Server Enabled
|
|
Computer
192.168.0.100
Noway2 (Programmer)
2 Mar 12 14:48
A few comments:
1 - Your running an outdated copy of Ubuntu.  Please upgrade this as soon as possible.  Ubuntu 8.04 was released in April 2008.  Even the LTS version was only supported for 3 years.  This means you haven't had sufficient updates to plug security holes in quite a long time.

2 - Sharing an internet connection is fairly easy to do, which is what it sounds like you are trying to do.  In addition to being a firewall, Iptables has NAT capability which will allow you to effectively bridge the two subnets, or at least route between them.  In order to do this, you will first need to turn on ipv4 forwarding in the kernel and make this retained across reboots.  Second, you can tell iptables to route across the LAN domains with a fairly simple command that uses the masquerade directive.  Here is a decent link: http://www.cyberciti.biz/faq/rhel-fedora-linux-internet-connection-sharing-howto/

Now, in terms of your physical connection, you can have your public IP go into one of your network interfaces with or without a NAT router in between.  As long as you get an internet connection, the above should work.  Now if you want to allow devices to connect to your LAN via wireless, I would recommend you use the bridge side of a wireless router and avoid trying to use it as an internet router / gateway; just use the LAN bridge ports.  When users connect to your wireless, they will get a LAN IP and that will route through your Ethernet connection on your server - which provides Internet via the wired interface.

 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close