Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: ipv6: add default gw in /etc/network/interfaces ?

  1. #1
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    ipv6: add default gw in /etc/network/interfaces ?

    Hi,

    My IPv6 is working, after a manual "sudo ip -6 route add default via fe80::21e:13ff:fef9:af0 dev eth0".

    I want it to work automatically, also after a reboot. I guess that means I have to add a command to /etc/network/interfaces. I tried a few different formats, but none work: nothing afters in my "ip -6 route show".

    So: what is the correct format?


    things tried:

    iface eth0 inet6 static
    gateway fe80::21e:13ff:fef9:af0


    and

    up route add default gw fe80::1

  2. #2
    Join Date
    Jun 2009
    Location
    Alabama
    Beans
    2,232

    Re: ipv6: add default gw in /etc/network/interfaces ?

    I don't recall having to do anything like that. IPv6 just works, for me. Maybe I had to change a firewall setting, but nothing in the routing.

    However, my IPv6 is controlled at my router, not by Ubuntu. Ubuntu just receives the router advertisement and uses it. Maybe that is the difference.

    Tim
    Cyberpower PC, Core i5 2500 3.3 gHz, 8GB DDR3, ATI 6770 1GB, Samsung BX 2440 LED 1080p, 1 TB SATA III, 2 TB SATA III, Siduction Linux 64-bit

  3. #3
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: ipv6: add default gw in /etc/network/interfaces ?

    Quote Originally Posted by ratcheer View Post
    I don't recall having to do anything like that. IPv6 just works, for me. Maybe I had to change a firewall setting, but nothing in the routing.

    However, my IPv6 is controlled at my router, not by Ubuntu. Ubuntu just receives the router advertisement and uses it. Maybe that is the difference.

    Tim
    Yep, that's true for the IPv6 at home. And it was true for the IPv6 on my VPS. However, the VPS provider apparently has some problem, and I need to add the route-add command. Therefor my question.

  4. #4
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,759
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ipv6: add default gw in /etc/network/interfaces ?

    Have you tried putting the ip command in your interfaces file?

    Code:
    iface eth0 inet6 static
        ...
        up ip -6 route add default via fe80::21e:13ff:fef9:af0 dev eth0
        ...
    Regards.

  5. #5
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: ipv6: add default gw in /etc/network/interfaces ?

    Quote Originally Posted by papibe View Post
    Have you tried putting the ip command in your interfaces file?

    Code:
    iface eth0 inet6 static
        ...
        up ip -6 route add default via fe80::21e:13ff:fef9:af0 dev eth0
        ...
    Regards.

    That results in this error:

    Code:
    sander@R540:~$ cat /etc/network/interfaces
    auto lo
    iface lo inet loopback
    
    iface eth0 inet6 static
        up ip -6 route add default via fe80::21e:13ff:fef9:af0 dev eth0
    
    
    sander@R540:~$ 
    sander@R540:~$ sudo service networking restart
    stop: Unknown instance: 
    networking stop/waiting
    sander@R540:~$

  6. #6
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,759
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ipv6: add default gw in /etc/network/interfaces ?

    For an static entry to work you would need also the fields 'address', 'netmask', and 'gateway'. Check this example.

    Do you have that information to set it up?

    Regards.

  7. #7
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: ipv6: add default gw in /etc/network/interfaces ?

    Quote Originally Posted by papibe View Post
    For an static entry to work you would need also the fields 'address', 'netmask', and 'gateway'. Check this example.

    Do you have that information to set it up?

    Regards.
    I changed /etc/network/interfaces to:

    Code:
    auto lo
    iface lo inet loopback
    
    ### Start IPV6 static configuration
    iface eth0 inet6 static
    pre-up modprobe ipv6
    address 2607:f0d0:2001:000a:0000:0000:0000:0010
    netmask 64
    gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
    ### END IPV6 configuration
    I did a

    Code:
    sudo service networking restart
    and no errors, but nothing had changed in ifconfig or the route table.

    Just to be sure I could add anything to eth0, I did a manual:

    Code:
    sudo ip addr add 1.2.3.4 dev eth0
    sudo ip -6 addr add 2001::4 dev eth0
    and that worked.

    So the suggested method does not work, alas

    I use 12.04. Are the config table the same as in earlier Ubuntu versions? FWIW: /etc/network/interfaces is (was) almost empty ...

    Your help is very appreciated

  8. #8
    Join Date
    Feb 2009
    Location
    Dallas, TX
    Beans
    7,759
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: ipv6: add default gw in /etc/network/interfaces ?

    The link on my previous post had the intention to show you an example of the structure of an static IPv6 entry. However, you should not use those address, use the one you are going to use (the ones on post #1).

    I also noticed that you assign an IPv4 address to eth0 after boot. You can define both IPv4 and IPv6 in the 'interfaces' file, check this other example.

    I hope that helps.
    Regards.

  9. #9
    Join Date
    Jan 2009
    Location
    ::1
    Beans
    2,485

    Re: ipv6: add default gw in /etc/network/interfaces ?

    Quote Originally Posted by papibe View Post
    The link on my previous post had the intention to show you an example of the structure of an static IPv6 entry. However, you should not use those address, use the one you are going to use (the ones on post #1).

    I also noticed that you assign an IPv4 address to eth0 after boot. You can define both IPv4 and IPv6 in the 'interfaces' file, check this other example.

    I hope that helps.
    Regards.
    Even with the 'wrong' address, they should appear in the ifconfig as shown by my 'manual' example: the fake IPv4 and IPv6 address appear in the ifconfig. But, alas, the example in your previous post and in your last post do not result in anything in ifconfig. Sorry.

  10. #10
    Join Date
    Dec 2010
    Beans
    573
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: ipv6: add default gw in /etc/network/interfaces ?

    This is basically what I have in my interfaces file for my IPv6 config on eth0:
    Code:
    iface eth0 inet6 static
         address 2001:1234:1234::40
         netmask 64
         up ip -6 route add default via 2001:1234:1234::1
         down ip -6 route del default via 2001:1234:1234::1
    This is working for me without the "dev eth0"

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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