Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network Interface setup

Status
Not open for further replies.

JoBlink

Technical User
May 28, 2004
38
US
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
 
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:
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top