Using multiple IP addresses at once

February 17th, 2013

Ever needed to configure a network-based device using a web interface, but found that its default IP address doesn’t match the setup of your network? e.g. Your new device uses 192.168.1.* and you use 192.168.0.* ?

Here’s an easy way to fix it: set up your machine to talk to both subnets at once. Here’s a little screencast to show how it’s done on the Mac.

Posted on Sunday, February 17th, 2013 at 1:12 pm and filed under Apple, Internet.

2 Responses to “Using multiple IP addresses at once”

  1. Dan Ellis Says:

    My mind is boggling over how to do that with ifconfig, or what ifconfig reports when you have done that – and does it scale to more subnets?

  2. qsf Says:

    Hi Dan –

    On Linux, you set up extra ‘aliases’ for the interface, called things like eth0:0, eth0:1 etc. And, yes, you can have lots of them. You can add them in /etc/network/interfaces, but to do it temporarily on the command line needs something like:

    sudo ifconfig eth0:0 netmask

    and then

    sudo ifconfig eth0:0 down

    when you’ve finished.

    Or, if you prefer the new ‘ip’ commands:

    sudo ip addr add dev eth0 label eth0:0
    sudo ip addr del dev eth0

    In many ways this is a lot like VLANs – there’s no problem in running multiple subnets at the same time on the same underlying network, be it wired or wireless. But the thing you need to remember is that nothing will forward packets between those subnets, or to the outside world, unless you take steps to make them do so.

    So, for example, you can’t just add your router as the way for things on the 192.168.1.* network to reach the outside world, because they don’t know how to talk to even that address, nor will it know how to talk back to them.

    But this trick was very useful for me recently when someone had installed a device out of reach above a customer’s ceiling without setting its network correctly…


Leave a Reply