LinuxQuestions.org
Visit Jeremy's Blog.
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-04-2015, 08:18 PM   #1
VolkHe
Member
 
Registered: Oct 2014
Posts: 33

Rep: Reputation: Disabled
How can I have two different iface's on two diff subnets?


Hi, I am running Raspbian, on my Raspberry Pi I have plugged in a Ethernet cable : eth0 and a Wifi Usb Dongle : wlan0

I have my etc/network/interfaces file configured like so

Code:
auto lo

iface lo inet loopback

iface eth0 inet dhcp

iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1

allow-hotplug wlan0

iface wlan0 inet static
        address 192.168.2.200
        netmask 255.255.255.0

iface default inet dhcp
When trying to connect with SSH to address 192.168.1.100, I get a connection, when trying with address 192.168.2.200, SSH returns Network Error: Connection timed out.

Also receive no response when trying to ping 192.168.2.200 from a windows machine

If however Iadjust the wlan0 block in etc/network/interfaces to the following

Code:
iface wlan0 inet static
        address 192.168.1.200
        netmask 255.255.255.0
I am able to connect to wlan0 in SSH to address 192.168.1.200, and I also receive requests when ping 192.168.1.200 from a windows machine.

How can I use a different subnet for my wlan0 iface
 
Old 09-04-2015, 10:22 PM   #2
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
At first glance I'd think you could put a gateway in the wlan settings.

This assumes a lot however too.
 
Old 09-05-2015, 09:28 AM   #3
VolkHe
Member
 
Registered: Oct 2014
Posts: 33

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
At first glance I'd think you could put a gateway in the wlan settings.

This assumes a lot however too.
Gateway doesnt do anything, plus it also works in my example above without one when address is 192.168.1.200 but not 192.168.2.200
 
Old 09-05-2015, 10:41 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
In a simple local LAN 192.168.1.0/24 or netmask 255.255.255.0 valid address are 192.168.1.1 - 192.168.1.254. Since 192.168.2.xxx is outside the range of valid addresses the computers can not talk to each other.

Normally in a managed wireless network all devices communicate via the access point. All wireless traffic goes between the router and whatever device is connected to the network. If you change the Pi's wlan static IP address to something outside the valid range it will not be able to communicate with the router.

Wireless devices can not communicate directly between each other on a managed network. To do this you need to setup the Pi wlan using ad-hoc mode which means you need to route traffic between your wired network and the Pi. If your USB wireless adapter is capable you can configure the Pi as an access point.

So what are you trying to accomplish?
 
Old 09-05-2015, 01:00 PM   #5
VolkHe
Member
 
Registered: Oct 2014
Posts: 33

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
In a simple local LAN 192.168.1.0/24 or netmask 255.255.255.0 valid address are 192.168.1.1 - 192.168.1.254. Since 192.168.2.xxx is outside the range of valid addresses the computers can not talk to each other.

Normally in a managed wireless network all devices communicate via the access point. All wireless traffic goes between the router and whatever device is connected to the network. If you change the Pi's wlan static IP address to something outside the valid range it will not be able to communicate with the router.

Wireless devices can not communicate directly between each other on a managed network. To do this you need to setup the Pi wlan using ad-hoc mode which means you need to route traffic between your wired network and the Pi. If your USB wireless adapter is capable you can configure the Pi as an access point.

So what are you trying to accomplish?
I am trying to accomplish being able to access wlan0 via 192.168.2.200 and eth0 via 192.168.1.100
Surely there must be some config which allows this, I cant believe its this hard.

I tried editing netmask to netmask 255.255.0.0 to both blocks in my [i]etc/network/interfaces[i] however this still doesnt let me connect.
 
Old 09-05-2015, 01:35 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
Do understand what I wrote about wireless networks in my previous post? I understand the task but understanding the end goal might help us offer better help.

Changing the netmask to 255.255.0.0 would then make it the same subnet. If you do want to try it then you need to change your computer, router and Pi netmask to 255.255.0.0?

Due to being a wireless it might be easier to switch and have the wired connection on a different subnet. You can add an IP alias and manual route on your computer. Others might have a better idea.

Last edited by michaelk; 09-05-2015 at 01:55 PM.
 
Old 09-06-2015, 11:44 PM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,092
Blog Entries: 1

Rep: Reputation: 90
Ok... show up the output of this command from the pi (as root):

Code:
ip route show
Then, what is the network configuration of the computer where you are trying to ping the pi from? It is also connected to both networks (192.168.1/24 and 192.168.2/24)?
 
  


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
GRE alias iface r00t Linux - Networking 5 02-18-2014 02:07 PM
/etc/network/interfaces too many parameters for iface line casperdaghost Linux - Newbie 1 01-13-2014 12:26 AM
[SOLVED] is it deadcode in mac80211/iface.c in .ndo_open mahesh kumar.E Linux - Kernel 1 06-07-2012 05:39 AM
Problem with iface line in /etc/networking/interfaces robert77546 Linux - Networking 1 04-01-2010 05:23 PM
12.0 ACPI/Ethernet IFace issues gankoji Slackware 7 05-05-2008 02:38 AM

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

All times are GMT -5. The time now is 11:19 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