Skip to content

Conversation

@alessiodionisi
Copy link
Contributor

Use the MAC address from PCI configuration (if provided) as documented in the man page.

Testing

HyperKit cmd:

build/hyperkit -A -u -U f9012ed3-3f13-4a5c-a2f4-f5af25d4826c -c 1 -m 1G -H -P -l com1,stdio -s 0,hostbridge -s 1,lpc -s 2,virtio-rnd -s 3,virtio-net,,mac=fC:72:d0:92:cb:0f -f kexec,boot2docker/vmlinuz,boot2docker/initrd.img,earlyprintk=serial console=ttyS0

Result of ifconfig on the vm:

docker@boot2docker:~$ ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:A2:97:FE:69
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr FC:72:D0:92:CB:0F
          inet addr:192.168.64.8  Bcast:192.168.64.255  Mask:255.255.255.0
          inet6 addr: fdde:cfff:f911:c64f:fe72:d0ff:fe92:cb0f/64 Scope:Global
          inet6 addr: fe80::fe72:d0ff:fe92:cb0f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:6190 (6.0 KiB)  TX bytes:5409 (5.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Ping from the vm:

docker@boot2docker:~$ ping -c 3 google.com
PING google.com (216.58.208.174): 56 data bytes
64 bytes from 216.58.208.174: seq=0 ttl=52 time=3.759 ms
64 bytes from 216.58.208.174: seq=1 ttl=52 time=4.025 ms
64 bytes from 216.58.208.174: seq=2 ttl=52 time=7.516 ms

--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 3.759/5.100/7.516 ms

macOS /var/db/dhcpd_leases:

{
	name=boot2docker
	ip_address=192.168.64.8
	hw_address=1,fc:72:d0:92:cb:f
	identifier=1,fc:72:d0:92:cb:f
	lease=0x5e99a99b
}

Ping from macOS to the vm:

❯ ping -c 3 192.168.64.8
PING 192.168.64.8 (192.168.64.8): 56 data bytes
64 bytes from 192.168.64.8: icmp_seq=0 ttl=64 time=0.252 ms
64 bytes from 192.168.64.8: icmp_seq=1 ttl=64 time=0.472 ms
64 bytes from 192.168.64.8: icmp_seq=2 ttl=64 time=0.344 ms

--- 192.168.64.8 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.252/0.356/0.472/0.090 ms

Use the MAC address from PCI configuration as documented in the man page.

Signed-off-by: Alessio Dionisi <hello@adns.io>
Copy link
Collaborator

@djs55 djs55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@alessiodionisi
Copy link
Contributor Author

Hi @djs55, can you merge this PR?

@djs55
Copy link
Collaborator

djs55 commented May 8, 2020

I was just leaving it in case someone else wanted to chime in. However it's been quite a while now so I think it's good to merge. Thanks for the PR!

@djs55 djs55 merged commit 8702deb into moby:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants