Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
02-05-2011, 04:06 PM
|
#1
|
LQ Newbie
Registered: Nov 2003
Location: Geneva
Distribution: suse
Posts: 17
Rep:
|
coexistence of a LAN connection and a broadband mobile connection
Description
I have a LAN (2 PC !) wire connected and I use a Huawei e182e to join the internet (If you have problem to install the Huawei on Linux, don't install drivers proposed on forums or don't try to unlock it. It's not necessary, simply install a kernel > 2.6.34 and it will install itself as a perfect plug and play).
On the unconnected machine, the Internet is accessible normally from the broadband dongle, but the connection stops when I plug the LAN cable.
It's normal since the PC cannot use both network connections simultaneously without a previous configuration, and the question is precisely there !
Bridging could be a solution but mobile broadband uses ppp protocol that is not on the same layer as wired LAN. brctl refuses to add the key into the bridge configuration.
Vtun seems a better approach since it works more independently from the protocols, but it must be installed on both sides and the broadband dongles does not accept software installation in it.
Documentation from Huawei is quite inexistent.
Actually the story could be the same for a computer connected to a wired LAN and using a wireless dongle, but here bridging is feasible (not tested by me) because they work on the same layer.
I tried to deactivate LAN switching in the BIOS: no result
static address with gateway pointing on the other device (I tried everything) no result.
How to bridge a ppp dongle with a wired LAN ?
|
|
|
02-07-2011, 05:02 AM
|
#2
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
Try using IP tables' NAT capability. It works at a higher level than bridging and I think it will work with your ppp device. I know it works when I use my cell phone which uses a PPP connection. I use this technique to get a connection to a credit card processing machine via a cross-over cable when I am in remote locations with only cell-phone internet access.
The first step is to turn on ip-v4 forwarding. In your /etc/syscontrol, set net.ipv4.ip_forward = 1. Note, in Ubuntu (which is what your info is showing you are using) it is /etc/sysctl.conf.
Then you need to use IP tables to "bridge" the interfaces. This is called ip masquerading. Use the following command:
Code:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
This assumes your interface is ppp0, check with ifconfig.
Finally, there are a couple of things you will need to do. First, make sure that you have a non-conflicting private LAN address for your LAN. By non-conflicting I mean one that is distinct from your ppp0 interface, which may use something like a 10.x.y.z address. You will need to set the gateway on the (second) PC to the IP address of your PC with the ppp0 interface. You will also need to setup the DNS servers on the second PC, which can be the ones of your provider.
|
|
1 members found this post helpful.
|
02-07-2011, 07:23 AM
|
#3
|
LQ Newbie
Registered: Nov 2003
Location: Geneva
Distribution: suse
Posts: 17
Original Poster
Rep:
|
Thank you for your answer, but no change ! anyway, it certainly the correct direction.
My configuration is 2 PCs connected with a LAN through a hub. The internet connection comes from the ppp0 that is a broadband mobile connection plugged into an USB port.
Hypothesis 1
The dongle is not a router and gives addresses that are not part of the LAN. I imagine that this address must be converted first into a local address.
Hypothesis 2
It's simply not possible !!
I'm confused and must read more before taking your time. I'll be back soon !!
sincerely.
|
|
|
02-07-2011, 10:07 AM
|
#4
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
Just to clarify, the command for iptables goes on the PC with the dongle, not the client/LAN PC that you want to get access. Also, yes, the dongle should give addresses that are not part of the lan and these should be associated with your ppp0 interface. For example, if your dongle gives 10.0.0.1, you can use 192.168.0.2 for the wired connection eth0 of this PC as it is a different range. Then on the 2nd PC, the one that you connect via the hub, give it an address of 192.168.0.3 and set its default gateway to 192.168.0.2. On 192.168.0.2 run the IP tables command shown above and turn on ipv4 forwarding. Note, especially the iptables command, it is not persistent across reboots unless you have an iptables configuration. The ipv4forwarding may not be either (I can't recall, but I remember reading something about this). Make sure you can ping from 192.168.0.3 to 192.168.0.2 and from 192.168.0.2 to wherever else like google.com. With the bridging features then enable, you should be able to ping from 192.168.0.3 to the same address. Remember, though that 192.168.0.3 will require DNS servers that it can access to resolve hostnames or else it will appear to not work.
|
|
1 members found this post helpful.
|
02-07-2011, 11:38 AM
|
#5
|
LQ Newbie
Registered: Nov 2003
Location: Geneva
Distribution: suse
Posts: 17
Original Poster
Rep:
|
I really appreciate your help.
I configured as explained and the machine 192.168.0.2 (the one with the dongle) stops pinging internet when I plug the LAN cable. Actually, I'm blocked on the very first step of the story.
|
|
|
02-07-2011, 12:01 PM
|
#6
|
LQ Newbie
Registered: Nov 2003
Location: Geneva
Distribution: suse
Posts: 17
Original Poster
Rep:
|
On the PC with the dongle I configured the eth0 to be 192.168.1.2 netmask 255.255.255.0 but what must be the gateway ? on the second PC it's clear but for me it's the next step.
|
|
|
02-07-2011, 01:50 PM
|
#7
|
LQ Newbie
Registered: Nov 2003
Location: Geneva
Distribution: suse
Posts: 17
Original Poster
Rep:
|
Finally that works and this is how:
On the computer with the dongle:
===================================
I configured IP forwarding as explained:
in the file /etc/sysctl.conf uncomment the line
net.ipv4.ip_forward=1
I rebooted as proposed on another forum and next
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables-save
NO REBOOT,
eth0 IPv4 settings
manual IP address 192.168.1.15 netmask 255.255.255.0 Gateway 0.0.0.0. DNS servers empty, search domains empty, no route defined
mobile broadband IPv4 settings
method automatic ppp
no route defined
Computer attached to the preceding one with a LAN wire
======================================================
eth0 IPv4 settings:
manual IP address 192.168.1.3 netmask 255.255.255.0 Gateway 192.168.1.15 DNS server: the one that appears on the dongle info box (preceding computer that has the dongle attached: right click on the network manager applet and select connection information) search domains empty, no route defined
No IP forwarding on this computer !
that's it
Many thanks to Noway2 that gave me the correct direction.
|
|
|
All times are GMT -5. The time now is 10:12 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|