LinuxQuestions.org
Visit Jeremy's Blog.
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 08-02-2016, 06:48 PM   #1
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS, Debian
Posts: 230
Blog Entries: 2

Rep: Reputation: 50
IP address assignments with a 3G modem.


I've been using Lx for years including Gentoo in the past, so I know the rudiments of networking. I'm now using Debian, getting into the nitty-gritty, and decided to start with a puzzle about my 3G modem. The box has a single ethernet socket for eth0 to which I assign 192.168.1.111. /etc/network/interfaces:
Code:
auto eth0
iface eth0 inet static
	address 192.168.1.111
	netmask 255.255.255.0
	broadcast 192.168.1.255
The modem configures itself as eth1 with 192.168.1.1 which I can ping. It's a Huawei with inbuilt web interface that presents a control screen at http://192.168.1.1/html/home.html Following boot, when I first try to access this it hangs. If I use ># ifdown eth0 I can access it, even if I then bring eth0 up again: ># ifup eth0. This is the first anomaly I don't understand.

The second is more fundamental. The kernel assigns 192...0 to both ports (which may be special-purpose?):
Code:
># route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         m.home          0.0.0.0         UG    1024   0        0 eth1
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
... yet this 192...0 address doesn't appear anywhere else. Also, it seems that the modem has also grabbed 192...100 which I can also ping:
Code:
># ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1c:c0:2d:36:d1  
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth1      Link encap:Ethernet  HWaddr 0c:5b:8f:27:9a:64  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e5b:8fff:fe27:9a64/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:55413 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43801 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:45164422 (43.0 MiB)  TX bytes:6906851 (6.5 MiB)
Can anyone throw light on these mysteries? Thanks for any replies.
 
Old 08-02-2016, 10:41 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,815

Rep: Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609
Is this some laptop with a built in 3g modem?

I can't figure out how you can have a eth0 and eth1 normally otherwise.
 
Old 08-03-2016, 05:04 AM   #3
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,416

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
What's happening is correct.

Your 3G modem is configured to use 192.168.1.0/24 as the "internal" networking, so when you plug it in, it's creating a (usb?) ethernet device (eth1) and assigning this the address of 192.168.1.100 and telling the kernal to use this interface (and IP address, etc.) to route traffic.

This conflicts with what you're configuring your onboard eth0 with manually, which is why it's showing up on your routing table as eth0.

You are trying to configure two NICs with the same network. This is generally considered a bad thing!.

Check your 3G device, you should be able to configure the "internal" networking to use a different network (192.168.2.0/24 for example) or configure your onboard with a non-conflicting network.

Last edited by TenTenths; 08-03-2016 at 05:06 AM.
 
Old 08-03-2016, 08:24 PM   #4
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS, Debian
Posts: 230

Original Poster
Blog Entries: 2

Rep: Reputation: 50
** PLS SEE NEXT POST FOR PARTIAL COMPREHENSION **

> Is this some laptop with a built in 3g modem?
> I can't figure out how you can have a eth0 and eth1 normally otherwise.

No, standard desktop. eth0 is the internal NIC, the eth1 stuff is all done by Modem Magic.

> Your 3G modem is configured to use 192.168.1.0/24 as the "internal" networking

i.e. the LAN, I take it. BTW, is 192...0 a "special address" in the way thet 192...255 is BROADCAST?

> when you plug it in, it's creating a (usb?) ethernet device (eth1)

Yep, can see that.

> and assigning this the address of 192.168.1.100

... some sort of default, I assume.

> and telling the kernal to use this interface (and IP address, etc.) to route traffic.

All clear so far.

> This conflicts with what you're configuring your onboard eth0 with manually, which is why it's showing up on your routing table as eth0.

I don't follow this. Where is the conflict, esp as eth0 isn't connected to anything? eth0 is in /etc/network/interfaces so I suppose it grabs the label (eth0) first, and the modem moves up to eth1? See next post.

> You are trying to configure two NICs with the same network.

But doesn't every device on a network have a Network Interface Chip with a different MAC and different IP address? Yes, but each device is assumed to have only ONE connection to each subnet, not two as I'd inadverdently set up.

> Check your 3G device, you should be able to configure the "internal" networking to use a different network (192.168.2.0/24 for example)

The best I can make of this is that the modem wants to act as a bridge between two subnets ( ..1.0 and ..2.0 ) and I'm trying to point it back to just one. I think this is about right.

My own ignorance of basic network theory is to blame here, but I've not been able to find anything in the literature I've got that explains this. If you'd be kind enough to clarify or point me to suitable lit I'd be most grateful, and many thanks for this reply.

I've pasted in the routing info after >#ifdown eth0. Still can't see where 192.168.1.1 comes into the story, other than that it seems to be a default address for most modem/routers:
Code:
qbx:~># ifconfig
eth1      Link encap:Ethernet  HWaddr 0c:5b:8f:27:9a:64  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e5b:8fff:fe27:9a64/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7457 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4959 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6980171 (6.6 MiB)  TX bytes:767539 (749.5 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:979 errors:0 dropped:0 overruns:0 frame:0
          TX packets:979 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:94070 (91.8 KiB)  TX bytes:94070 (91.8 KiB)

qbx:~># ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=23.4 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=22.0 ms
^C
--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 22.093/22.761/23.429/0.668 ms
qbx:~># netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
default         m.home          0.0.0.0         UG        0 0          0 eth1
192.168.1.0     *               255.255.255.0   U         0 0          0 eth1
qbx:~>#

Last edited by tekra; 08-03-2016 at 11:37 PM.
 
Old 08-03-2016, 08:33 PM   #5
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS, Debian
Posts: 230

Original Poster
Blog Entries: 2

Rep: Reputation: 50
Just had a flash of ?insight? I'd been thinking of the modem as something "external" when in fact it's "internal" - i.e. a part of the box.

So the entire BOX becomes a router, and its two eth ports must therefore point to different subnets. Correct?
 
Old 08-03-2016, 10:23 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,815

Rep: Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609Reputation: 3609
I'd say yes if you can tell us how this modem is attached to your desktop.
 
Old 08-03-2016, 11:38 PM   #7
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS, Debian
Posts: 230

Original Poster
Blog Entries: 2

Rep: Reputation: 50
> I'd say yes if you can tell us how this modem is attached to your desktop.

Standard USB 3G modem - by a USB port. But it "fakes" a network connection - i.e. NIC. This "masquerading" that USB devices do is one of the trickiest things to document unless you're perfectly clear about what's going on, in my experience.

I've now got a different "mental schematic" of the setup thanks to TenTenths. Am using Dia to get it down on paper.

Last edited by tekra; 08-03-2016 at 11:41 PM.
 
Old 08-04-2016, 04:17 AM   #8
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,416

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
Quote:
Originally Posted by tekra View Post
Just had a flash of ?insight? I'd been thinking of the modem as something "external" when in fact it's "internal" - i.e. a part of the box.

So the entire BOX becomes a router, and its two eth ports must therefore point to different subnets. Correct?
Yup, you're getting there.

So, you now have a laptop that has two ethernet connections. One it the classic "hole in the laptop" that a cable goes in to. The other is created when you plug in your 3G modem. This acts like an ethernet network with two devices on it. Your laptop and the 3G modem. The "lan" side of this device is using then network 192.168.1.0 which is really a shorthand for the subnet 192.168.1.1 to 192.168.1.255

Your 3G modem is assigning itself the network address of 192.168.1.1 and is then giving your laptop a DHCP address of 192.168.1.100 (as it likely has this as the start of its DHCP "pool" and giving it the default gateway of 192.168.1.1

If you're using the route command then use route -n which will display the IP addresses of things rather than changing some of them to names.

192.168.1.0 is indeed a "special" subnet. It's part of the reserved private address space and is the most common one used for off-the-shelf devices such as routers/modems/etc. https://en.wikipedia.org/wiki/Privat...address_spaces
 
Old 08-04-2016, 08:56 AM   #9
tekra
Member
 
Registered: Aug 2010
Location: Brisbane, Australia
Distribution: Gentoo, Slackware, PCLOS, Debian
Posts: 230

Original Poster
Blog Entries: 2

Rep: Reputation: 50
> So, you now have a laptop that has two ethernet connections ... 192.168.1.1 to 192.168.1.255

Yes, all clear now.

> use route -n

THAT's what I was looking for. Just 'route' shows it calling itself 'm.home' whereas'route -n' shows the 'missing IP' 192.168.1.1.

> 192.168.1.0 is indeed a "special" subnet. It's part of the reserved private address space ...

Thought I remembered this from somewhere.

BTW for others watching this and my own clarification:

I remember way back when I had one of the early Inet wireless modems, I think it connected via Cat5 but using PPPOE - PPP protocol over Ethernet - and so 'looked like' a serial port, not a network connection. My other USB 3G modem is a Huawei E169 which 'looks like' a serial port and can be set up using PPP according to OpenWrt docn, in which case it would not be a network connection as far as the box is concerned. This new modem is a Huawei E8372 which 'looks like' a NIC and so IS a network conx to the box. Yes?

Many thanks for your clues and explanations; I'll put away the ouija board and the voodoo mask.
 
Old 08-04-2016, 09:17 AM   #10
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,416

Rep: Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541Reputation: 1541
You're welcome.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
C++ Tutorial With Assignments Ace Blackwell Programming 4 10-11-2009 12:02 PM
Device assignments Linear_z Linux - Hardware 1 12-18-2006 01:08 AM
bash - review assignments tarja Programming 4 11-24-2005 02:12 PM
DHCP assignments across two subnets otisthegbs Linux - Networking 5 04-25-2004 12:16 AM
Key Assignments orlenok Linux - General 1 10-04-2003 02:37 PM

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

All times are GMT -5. The time now is 04:31 PM.

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