Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Two different subnets for two different interfaces - only one works!


    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

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    I think your network mask needs to be 255.255.0.0.

  3. #3
    -->
    Quote Originally Posted by gregm View Post
    I think your network mask needs to be 255.255.0.0.
    Hi, I set both masks in my config like the following

    Code:
    iface eth0 inet static
            address 192.168.1.100
            netmask 255.255.0.0
            gateway 192.168.1.1
    
    allow-hotplug wlan0
    
    iface wlan0 inet static
            address 192.168.2.200
            netmask 255.255.0.0
    When connecting via eth0 and running ifconfig -a I can see that the netmask is set correctly on both ifaces at netmask 255.255.0.0 however I still cannot connect at that address.

    I do think you are heading in the right direction...

$spacer_open
$spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •