Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want access to two networks:

  • a PPPoE network: for external computers (www, etc.)
    • IP(dhcp), DNS, default route
  • a LAN for access to other local computers (local file sharing)
    • IP(dhcp), no DNS, only LAN route

Both networks are setup through the same Ethernet connection.

One way of accessing both networks at the same time is to connect to PPPoE from network-manager, and add the LAN info by hand:

  • add an IP on eth0
  • add a route for traffic to that network

I can configure two distinct connections in NetworkManager, but because both are on the same physical (Ethernet) network, selecting one of them makes the other one disconnect => can't have both of them at the same time.

Is there a way to have both of the active simultaneously?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I found a solution that seems to work with an ethernet port managed by NM.
I'm no expert and am new to NM and Ubuntu -so be advised.

Using Ubuntu 12.04 Added a script: /etc/NetworkManager/dispatcher.d/wjw-alias-eth1
(an edited version of installed file: /etc/NetworkManager/dispatcher.d/01ifupdown).

NM docs say scripts in dispatcher.d are run in alphabetic sort order, so name your added file so it runs last.

In my case eth1 is behind a router which assigns an IP# via 'static' DHCP.
I need a 2nd IP# on the same LAN segment so I can run two DLNA servers at the same time. (Mythtv and Serviio in my case.) It seems DLNA servers must each bind to a different IP#. I wanted to keep NM managing eth1 to keep using its built in goodies

my added script:

#!/bin/sh -e
# Script for nm to add an alias eth1:0 and multicast routing on eth1 up---wjw

if [ -z "$1" ]; then
    echo "$0: called with no interface" 1>&2
    exit 1;
fi
        eth1="eth1"
if [ "$1" != "$eth1" ]; then
        exit 0;
fi


# Run the right scripts
case "$2" in
    up|vpn-up)
        ifconfig eth1:0 192.168.10.10  netmask 255.255.255.0 broadcast 192.168.10.255
        route add -net 239.0.0.0 netmask 255.0.0.0 dev eth1:0
        ;;
    down|vpn-down|hostname|dhcp4-change|dhcp6-change)
        # Do nothing more
        exit 0
        ;;
    *)
        echo "$0: called with unknown action \`$2'" 1>&2
        exit 1
        ;;
esac
share|improve this answer
add comment

You can create an alias. Both of which are on the same subnet. You can then assign your services accordingly.

ifconfig eth0:0 10.0.0.3
ifconfig eth0:1 10.0.0.4
share|improve this answer
    
Yep, that works, but I was looking for a complete network-manager based solution, with no cli involved. But I guess if I automate the creation of the alias on start up, no cli will be needed afterwards. –  Lucian Adrian Grijincu Oct 10 '10 at 23:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.