Skip to content

Commit 6fde617

Browse files
committed
# This is a combination of 2 commits.
# The first commit's message is: Incorporated code review comments # The 2nd commit message will be skipped: # fixed formatting
1 parent 268980f commit 6fde617

File tree

9 files changed

+131
-104
lines changed

9 files changed

+131
-104
lines changed

Godeps/Godeps.json

-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $ vagrant ssh netplugin-node1
3939
```
4040
$ netctl net create contiv-net --subnet=20.1.1.0/24
4141
or
42-
netctl net create contiv-net --subnet=20.1.1.0/24 --pkt-tag=1001 --subnetv6=2001::/100
42+
netctl net create contiv-net --subnet=20.1.1.0/24 --subnetv6=2001::/100
4343
```
4444

4545
#### Step 3: Run your containers and enjoy the networking!

docs/ipv6.md

+45
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,48 @@ The containers created will get IPv4 and IPv6 address allocated from the corresp
5252
]
5353
```
5454

55+
## Container IPv6 interface
56+
57+
Container 'web' in Node1
58+
```
59+
[vagrant@netplugin-node1 netplugin]$ docker exec -it web /bin/sh
60+
/ # ip addr show dev eth0
61+
13: eth0@if12: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue state UP
62+
link/ether 02:02:14:01:01:03 brd ff:ff:ff:ff:ff:ff
63+
inet 20.1.1.3/24 scope global eth0
64+
valid_lft forever preferred_lft forever
65+
inet6 2001::3/100 scope global
66+
valid_lft forever preferred_lft forever
67+
inet6 fe80::2:14ff:fe01:103/64 scope link
68+
valid_lft forever preferred_lft forever
69+
/ #
70+
```
71+
72+
Container 'db' in Node2
73+
```
74+
[vagrant@netplugin-node2 ~]$ docker exec -it db /bin/sh
75+
/ # ip addr show dev eth0
76+
9: eth0@if8: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue state UP
77+
link/ether 02:02:14:01:01:04 brd ff:ff:ff:ff:ff:ff
78+
inet 20.1.1.4/24 scope global eth0
79+
valid_lft forever preferred_lft forever
80+
inet6 2001::4/100 scope global
81+
valid_lft forever preferred_lft forever
82+
inet6 fe80::2:14ff:fe01:104/64 scope link
83+
valid_lft forever preferred_lft forever
84+
/ #
85+
```
86+
87+
## Ping6 between containers
88+
```
89+
/ # ping6 2001::4 -I 2001::3 -c 3
90+
PING 2001::4 (2001::4) from 2001::3: 56 data bytes
91+
64 bytes from 2001::4: seq=0 ttl=64 time=1.689 ms
92+
64 bytes from 2001::4: seq=1 ttl=64 time=2.437 ms
93+
64 bytes from 2001::4: seq=2 ttl=64 time=1.526 ms
94+
95+
--- 2001::4 ping statistics ---
96+
3 packets transmitted, 3 packets received, 0% packet loss
97+
round-trip min/avg/max = 1.526/1.884/2.437 ms
98+
/ #
99+
```

netmaster/master/network.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func CreateNetwork(network intent.ConfigNetwork, stateDriver core.StateDriver, t
158158
nwCfg.IPv6Gateway = network.IPv6Gateway
159159

160160
// Reserve gateway IPv6 address if gateway is specified
161-
hostID, err := netutils.GetIPv6HostID(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, 128, nwCfg.IPv6Gateway)
161+
hostID, err := netutils.GetIPv6HostID(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, nwCfg.IPv6Gateway)
162162
if err != nil {
163163
log.Errorf("Error parsing gateway address %s. Err: %v", nwCfg.IPv6Gateway, err)
164164
return err
@@ -503,12 +503,12 @@ func networkAllocAddress(nwCfg *mastercfg.CfgNetworkState, reqAddr string, isIPv
503503
if reqAddr == "" {
504504
if isIPv6 {
505505
// Get the next available IPv6 address
506-
hostID, err = netutils.GetNextIPv6HostID(nwCfg.IPv6LastHost, nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, 128, nwCfg.IPv6AllocMap)
506+
hostID, err = netutils.GetNextIPv6HostID(nwCfg.IPv6LastHost, nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, nwCfg.IPv6AllocMap)
507507
if err != nil {
508508
log.Errorf("create eps: error allocating ip. Error: %s", err)
509509
return "", err
510510
}
511-
ipAddress, err = netutils.GetSubnetIPv6(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, 128, hostID)
511+
ipAddress, err = netutils.GetSubnetIPv6(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, hostID)
512512
if err != nil {
513513
log.Errorf("create eps: error acquiring subnet ip. Error: %s", err)
514514
return "", err
@@ -540,7 +540,7 @@ func networkAllocAddress(nwCfg *mastercfg.CfgNetworkState, reqAddr string, isIPv
540540

541541
} else if reqAddr != "" && nwCfg.SubnetIP != "" {
542542
if isIPv6 {
543-
hostID, err = netutils.GetIPv6HostID(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, 128, reqAddr)
543+
hostID, err = netutils.GetIPv6HostID(nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, reqAddr)
544544
if err != nil {
545545
log.Errorf("create eps: error getting host id from hostIP %s Subnet %s/%d. Error: %s",
546546
reqAddr, nwCfg.IPv6Subnet, nwCfg.IPv6SubnetLen, err)
@@ -578,7 +578,7 @@ func networkAllocAddress(nwCfg *mastercfg.CfgNetworkState, reqAddr string, isIPv
578578
func networkReleaseAddress(nwCfg *mastercfg.CfgNetworkState, ipAddress string) error {
579579
isIPv6 := netutils.IsIPv6(ipAddress)
580580
if isIPv6 {
581-
hostID, err := netutils.GetIPv6HostID(nwCfg.SubnetIP, nwCfg.SubnetLen, 128, ipAddress)
581+
hostID, err := netutils.GetIPv6HostID(nwCfg.SubnetIP, nwCfg.SubnetLen, ipAddress)
582582
if err != nil {
583583
log.Errorf("error getting host id from hostIP %s Subnet %s/%d. Error: %s",
584584
ipAddress, nwCfg.SubnetIP, nwCfg.SubnetLen, err)

0 commit comments

Comments
 (0)