extending at the edge - Yes!

Thomas Schäfer thomas at cis.uni-muenchen.de
Sun Oct 21 14:40:11 CEST 2012


Am 12.10.2012 21:12, schrieb Thomas Schäfer:
> Am 11.10.2012 01:40, schrieb Cameron Byrne:
>> Yes, IETF is looking into this  case. Please feel free to comment on
> > it here or v6ops http://tools.ietf.org/html/draft-byrne-v6ops-64share
So here is my first automated solution.

Devices: surfstick, notebook one, notebook two

Notebook two needs no changes except DNS.
All the important things happen on notebook one.
I did not change the IP-addresses to 2001:db8::
Script and log are real, only the apn was cleared.

Improvements are welcome. I am a bad programmer. "sleep" is a bad 
command, also greping the IP-addresses is not very reliable, in the way 
I did.

Regards,
Thomas
-------------- next part --------------
#!/bin/bash
#
#  Internet connection sharing
#
#  wwan0 with /64 learned via SLAAC to eth0
#
#  tools:
#       #ndppd
#        npd6
#        radvd
#
#   some variables
#ndpd_conf="/etc/ndppd.conf"
radvd_conf="/etc/radvd.conf"
npd6_conf="/etc/npd6.conf"
iface_ext="wwan0"
iface_int="eth0"

# forwarding/routing conflicts with SLAAC/RA therefore we start in none-router-mode

####/sbin/sysctl net.ipv6.conf.all.forwarding=0

# connecting wwan
/usr/local/bin/mmcli -m 0 --simple-connect="allowed-modes=3g,apn=xxxxxxxxxxxxxx,ip-type=ipv6" --verbose --timeout=500

/usr/bin/sleep 1

/usr/sbin/ip link set ${iface_ext} up

/usr/bin/sleep 2

/usr/bin/ping6 -c 2 2600::

/usr/bin/sleep 1

# status
/usr/sbin/ip -6 addr show
/usr/bin/echo "-----------------------------------------------------------------------------------"
/usr/sbin/ip -6 route show
/usr/bin/echo "-----------------------------------------------------------------------------------"

# read IP-adresses

ip1_ext=`/usr/sbin/ip -6 addr show ${iface_ext} |\
         /usr/bin/grep "scope global dynamic" |\
         /usr/bin/cut -f6 -d " " |\
         /usr/bin/cut -f1-8 -d ":"|\
         /usr/bin/cut -f1 -d "/" |\
         /usr/bin/grep "^[2|3]"`

ip2_ext=`/usr/sbin/ip -6 addr show ${iface_ext} |\
         /usr/bin/grep "scope global temporary dynamic"|\
         /usr/bin/cut -f6 -d " "|\
         /usr/bin/cut -f1-8 -d ":"|\
         /usr/bin/cut -f1 -d "/"|\
         /usr/bin/grep "^[2|3]"`

prefix=`/usr/sbin/ip -6 addr show ${iface_ext} |\
        /usr/bin/grep "scope global dynamic" |\
        /usr/bin/cut -f6 -d " " |\
        /usr/bin/cut -f1-4 -d ":" |\
        /usr/bin/grep "^[2|3]"`


# read defaultroute
# example output : default via fe80::8029:b2bd:ce33:6f1f dev wwan0  proto ra  metric 1024  expires 65534sec

defaultroute=`/usr/sbin/ip -6 route show |\
              /usr/bin/grep default |\
              /usr/bin/cut -d " " -f 3`


/usr/bin/echo "IP-address 1  "${ip1_ext}
/usr/bin/echo "IP-address 2  "${ip2_ext}
/usr/bin/echo "prefix        "${prefix}
/usr/bin/echo "default route "${defaultroute}

/usr/sbin/ip -6 addr  delete ${ip1_ext}/64  dev ${iface_ext}
/usr/sbin/ip -6 addr  delete ${ip2_ext}/64  dev ${iface_ext}
/usr/sbin/ip -6 route delete ${prefix}::/64 dev ${iface_ext}
# make external net small, set the internal network
/usr/sbin/ip -6 addr  add    ${ip1_ext}/128 dev ${iface_ext}
/usr/sbin/ip -6 addr  add    ${ip1_ext}/64  dev ${iface_int}
# replace ra-set-route by manually set route
/usr/sbin/ip -6 route delete default via ${defaultroute} dev ${iface_ext}
/usr/sbin/ip -6 route add    default via ${defaultroute} dev ${iface_ext}


/sbin/sysctl net.ipv6.conf.all.forwarding=1
/sbin/sysctl net.ipv6.conf.${iface_ext}.proxy_ndp=1

#### create /etc/radvd.conf

/usr/bin/echo "interface eth0"                                                    > ${radvd_conf}
/usr/bin/echo "{"                                                                >> ${radvd_conf}
/usr/bin/echo "       AdvSendAdvert on;"                                         >> ${radvd_conf}
/usr/bin/echo ""                                                                 >> ${radvd_conf}
/usr/bin/echo "       # life time zero means we don't actually advertise a"      >> ${radvd_conf}
/usr/bin/echo "       # router but only our ULA address. Remove if you want this">> ${radvd_conf}
/usr/bin/echo "       # host to be advertised as router."                        >> ${radvd_conf}
/usr/bin/echo "       ##AdvDefaultLifetime 0;"                                   >> ${radvd_conf}
/usr/bin/echo ""                                                                 >> ${radvd_conf}
/usr/bin/echo ""                                                                 >> ${radvd_conf}
/usr/bin/echo "      prefix "${prefix}"::/64"                                    >> ${radvd_conf}
/usr/bin/echo "       {"                                                         >> ${radvd_conf}
/usr/bin/echo "        AdvOnLink on;"                                            >> ${radvd_conf}
/usr/bin/echo "        AdvAutonomous on;"                                        >> ${radvd_conf}
/usr/bin/echo "        AdvRouterAddr on;"                                        >> ${radvd_conf}
/usr/bin/echo "       };"                                                        >> ${radvd_conf}
/usr/bin/echo "};"                                                               >> ${radvd_conf}
/usr/bin/echo ""                                                                 >> ${radvd_conf}

#### create /etc/npd6.conf

/usr/bin/echo "// npd6 config file"                                                >${npd6_conf}
/usr/bin/echo ""                                                                  >>${npd6_conf}
/usr/bin/echo "// The prefix portion that we will match on"                       >>${npd6_conf}
/usr/bin/echo "//prefix=2a01:0123:4567:89aa:"                                     >>${npd6_conf}
/usr/bin/echo "prefix="${prefix}":"                                               >>${npd6_conf}
/usr/bin/echo ""                                                                  >>${npd6_conf}
/usr/bin/echo ""                                                                  >>${npd6_conf}
/usr/bin/echo "// Which interface are we monitoring and using?"                   >>${npd6_conf}
/usr/bin/echo "interface = "${iface_ext}                                          >>${npd6_conf}
/usr/bin/echo ""                                                                  >>${npd6_conf}
/usr/bin/echo "listtype = none"                                                   >>${npd6_conf}
/usr/bin/echo "listlogging = off"                                                 >>${npd6_conf}
/usr/bin/echo "collectTargets = 100"                                              >>${npd6_conf}
/usr/bin/echo "linkOption = false"                                                >>${npd6_conf}
/usr/bin/echo "ignoreLocal = true"                                                >>${npd6_conf}
/usr/bin/echo "routerNA = true"                                                   >>${npd6_conf}
/usr/bin/echo "maxHops = 255"                                                     >>${npd6_conf}
/usr/bin/echo ""                                                                  >>${npd6_conf}

# starting npd6
# /etc/init.d/npd6 start     # does not work for me

/usr/local/bin/npd6

# starting radvd via systemd

/bin/systemctl start radvd.service

-------------- next part --------------
bash ics.sh
[21 Okt 2012, 13:39:34] [Debug] Forcing request to be run asynchronously
[21 Okt 2012, 13:39:34] [Debug] Assuming '0' is the modem index
[21 Okt 2012, 13:39:34] [Debug] ModemManager process found at ':1.41'
[21 Okt 2012, 13:39:34] [Debug] Modem found at '/org/freedesktop/ModemManager1/Modem/0'

[21 Okt 2012, 13:39:34] [Debug] Asynchronously connecting the modem...
successfully connected the modem
PING 2600::(2600::) 56 data bytes
64 bytes from 2600::: icmp_seq=2 ttl=51 time=211 ms

--- 2600:: ping statistics ---
2 packets transmitted, 1 received, 50% packet loss, time 1007ms
rtt min/avg/max/mdev = 211.634/211.634/211.634/0.000 ms
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 fe80::3ed9:2bff:fe1a:c99a/64 scope link 
       valid_lft forever preferred_lft forever
5: wwan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
    inet6 2a01:198:24c:c110:e085:fa9f:ba93:a950/64 scope global temporary dynamic 
       valid_lft 604788sec preferred_lft 85788sec
    inet6 2a01:198:24c:c110:ac38:c7ff:fe77:bb0/64 scope global dynamic 
       valid_lft forever preferred_lft forever
    inet6 fe80::ac38:c7ff:fe77:bb0/64 scope link 
       valid_lft forever preferred_lft forever
-----------------------------------------------------------------------------------
2a01:198:24c:c110::/64 dev wwan0  proto kernel  metric 256 
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev wwan0  proto kernel  metric 256 
default via fe80::1c64:4ceb:bc9e:9135 dev wwan0  proto ra  metric 1024  expires 65524sec
-----------------------------------------------------------------------------------
IP-address 1  2a01:198:24c:c110:ac38:c7ff:fe77:bb0
IP-address 2  2a01:198:24c:c110:e085:fa9f:ba93:a950
prefix        2a01:198:24c:c110
default route fe80::1c64:4ceb:bc9e:9135
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.wwan0.proxy_ndp = 1





ifconfig 
eth0      Link encap:Ethernet  Hardware Adresse 3C:D9:2B:1A:C9:9A  
          inet6 Adresse: fe80::3ed9:2bff:fe1a:c99a/64 Gültigkeitsbereich:Verbindung
          inet6 Adresse: 2a01:198:24c:c110:ac38:c7ff:fe77:bb0/64 Gültigkeitsbereich:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 Sendewarteschlangenlänge:1000 
          RX bytes:1754 (1.7 Kb)  TX bytes:31342 (30.6 Kb)

lo        Link encap:Lokale Schleife  
          inet Adresse:127.0.0.1  Maske:255.0.0.0
          inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:76 errors:0 dropped:0 overruns:0 frame:0
          TX packets:76 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 Sendewarteschlangenlänge:0 
          RX bytes:26981 (26.3 Kb)  TX bytes:26981 (26.3 Kb)

wwan0     Link encap:Ethernet  Hardware Adresse AE:38:C7:77:0B:B0  
          inet6 Adresse: fe80::ac38:c7ff:fe77:bb0/64 Gültigkeitsbereich:Verbindung
          inet6 Adresse: 2a01:198:24c:c110:ac38:c7ff:fe77:bb0/128 Gültigkeitsbereich:Global
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:19 errors:0 dropped:0 overruns:0 frame:0
          TX packets:77 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 Sendewarteschlangenlänge:1000 
          RX bytes:1838 (1.7 Kb)  TX bytes:13618 (13.2 Kb)
                                                            
                                                            












More information about the ipv6-ops mailing list