Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all, I'm running gentoo on a notebook. In my work i have a static IP address, and in my home the IP is given by dhcp. Every time i ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2004
    Posts
    3

    dual network configuration


    Hi all,

    I'm running gentoo on a notebook. In my work i have a static IP address, and in my home the IP is given by dhcp.

    Every time i have to modify /etc/conf.d/net config file (and work well in both cases) in order to get network running, and the boot is very slow since tries to get up eth0 with the wrong configuration.

    I think that maybe is a good idea is to define two runlevels, but i don't know how to define two configuration files for the same net card.

    Any help or better ideas?

    Thanks very much.

  2. #2
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    I think this will work:

    Code:
    su -
    cp /etc/init.d/net.eth0 /etc/init.d/net.eth1
    Now add this line to your /etc/conf.d/net:

    Code:
    iface_eth1="dhcp"
    Configure your work static IP under iface_eth0 and remove net.eth0 from all runlevels it's in. The only catch here is you have to manually start the net interface.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Posts
    3
    Currently i am in my work, so i did it but with the new created net.eth1 as the one with static IP (to see now if it works)

    Quote Originally Posted by sarumont

    Code:
    su -
    cp /etc/init.d/net.eth0 /etc/init.d/net.eth1
    ok.

    Quote Originally Posted by sarumont
    Now add this line to your /etc/conf.d/net:

    Code:
    iface_eth1="dhcp"
    Configure your work static IP under iface_eth0 and remove net.eth0 from all runlevels it's in. The only catch here is you have to manually start the net interface.
    i did:

    Code:
    iface_eth0="dhcp"
    and configure the static IP under iface_eth1. Then i stop eth0 and start eth1:

    Code:
    /etc/init.d/net.eth1 start
     * Bringing eth1 up (146.155.14.xx)...
    SIOCSIFADDR: No such device
    eth1: unknown interface: No such device
    SIOCSIFBRDADDR: No such device
    eth1: unknown interface: No such device
    SIOCSIFNETMASK: No such device                                            [ !! ]
    Is this problem because i should did it as you said (eth0 with static IP)?

    Anyway i will try the other way when i get home.

    Thanks for your help.

  4. #4
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    d0h...comment this line out of the /etc/init.d/net.eth1:

    Code:
    local i iface="${1//./_}"
    and add this in it's place:

    Code:
    iface="eth0"
    That should do the trick.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  5. #5
    Just Joined!
    Join Date
    Jul 2004
    Posts
    3
    I change the line in /etc/init.d/net.eth1, but i get the following message when trying to bring up eth1 (configured with static IP)

    Code:
    /etc/init.d/net.eth1 start
     * Bringing eth1 up via DHCP...                                           [ !! ]
    So, tries to bring up the eth1 with the configuration of eth0. I already tried (yesterday at home) switching configuration between eth0 and eth1 and i had the same problem.

    Thanks again.

Posting Permissions

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