facebookarchive / augmented-traffic-control

Augmented Traffic Control: A tool to simulate network conditions
https://facebook.github.io/augmented-traffic-control
Other
4.33k stars 599 forks source link

[osx][docker] network interface wrong #301

Closed jhaoheng closed 8 years ago

jhaoheng commented 8 years ago

Hello, i use docker to build atcd/atc image on OSX

and i run container with this cmd docker run -it --privileged --network=host --rm -e ATCD_LAN=en0 -e ATCD_WAN=en4 ${USER}/atc

en0 : is my wifi en4 : is my ethernet and bridge100 is my internet share with wifi

but whatever i set anyone on the ATCD , the error log is

atcd stderr | CRITICAL:AtcdVService.AtcdLinuxShaper:One of the following interfaces does not exist: en0, en4 atcd stderr | ERROR:sparts.tasks:Error creating task, AtcdLinuxShaper

Does anyone know how to fix this?

smorad commented 8 years ago

Can you paste the results of ifconfig from your host OS, and from within the docker instance?

jhaoheng commented 8 years ago

Hi @smorad Thank your reply. This is my osx all network interface , but the docker instance not start success , so can't get info.

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
    ether 84:38:35:59:f3:50 
    inet6 fe80::8638:35ff:fe59:f350%en0 prefixlen 64 scopeid 0x4 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
    options=60<TSO4,TSO6>
    ether 32:00:17:21:40:00 
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
    ether 06:38:35:59:f3:50 
    media: autoselect
    status: inactive
awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1484
    ether 5e:ac:6b:11:e1:e5 
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=63<RXCSUM,TXCSUM,TSO4,TSO6>
    ether 86:38:35:95:6f:00 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en1 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 5 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: <unknown type>
    status: inactive
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
    ether 0c:4d:e9:cb:8b:8a 
    inet6 fe80::e4d:e9ff:fecb:8b8a%en4 prefixlen 64 scopeid 0x9 
    inet 192.168.1.110 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=1<PERFORMNUD>
    media: autoselect (100baseTX <full-duplex,flow-control>)
    status: active
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=3<RXCSUM,TXCSUM>
    ether 86:38:35:95:6f:64 
    inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
    inet6 fe80::8438:35ff:fe95:6f64%bridge100 prefixlen 64 scopeid 0xa 
    Configuration:
        id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
        maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
        root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
        ipfilter disabled flags 0x2
    member: en0 flags=3<LEARNING,DISCOVER>
            ifmaxaddr 0 port 4 priority 0 path cost 0
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
smorad commented 8 years ago

@jhaoheng is that from within the docker instance? I suspect that you don't have an en4 interface within your docker instance. Can you please verify it exists?

You don't have to run ATC within docker, just run a default docker instance and see if your adapters exist.

https://docs.docker.com/engine/userguide/networking/

smorad commented 8 years ago

Also I see your using a mac, please note that ATC does not work with macs, as it uses Linux tools like tc. You should be okay if you use a Linux VM.

jhaoheng commented 8 years ago

Hi @smorad

I mistake, the atc tell me the container can't find this two interface, it not mean the 'container is not built'.

So i run docker network inspect host

$docker network inspect host
[
    {
        "Name": "host",
        "Id": "aa7778d58e946458ff5878b1b51aac828a7ca5e3aada24861fb480621f85194d",
        "Scope": "local",
        "Driver": "host",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": []
        },
        "Internal": false,
        "Containers": {
            "6c79b61fa02b175699cf6a73e6a0fc45a5e891a3165c651a2bed20f55c13702b": {
                "Name": "zen_colden",
                "EndpointID": "f2a985315779da58bf84ed05e22de3e41207d8e775876dc181289f4a2041fe9d",
                "MacAddress": "",
                "IPv4Address": "",
                "IPv6Address": ""
            }
        },
        "Options": {},
        "Labels": {}
    }
]

and i into the container and run ifconfig

docker0   Link encap:Ethernet  HWaddr 02:42:b0:19:21:86  
          inet addr:172.17.0.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:b0ff:fe19:2186/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:4201 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7156 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:171870 (167.8 KiB)  TX bytes:10479049 (9.9 MiB)

eth0      Link encap:Ethernet  HWaddr c0:ff:ee:c0:ff:ee  
          inet addr:192.168.65.2  Bcast:192.168.65.15  Mask:255.255.255.240
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:246496 errors:0 dropped:0 overruns:0 frame:0
          TX packets:123517 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:362907322 (346.0 MiB)  TX bytes:6751964 (6.4 MiB)

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:1 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

and i can't find the eth1 on container. what wrong?

jhaoheng commented 8 years ago

Hi smorad

you mean atcd/atc docker image only could build on linux base NOT osx base. and atcd/atc could find eth0 & eth1 on linux?

Does i build it on raspberry which is installed ubuntu and it will work? Sorry i have not been try. Because i want to try it on my osx docker first, to prove it could build on docker.

chantra commented 8 years ago

On Mac osx docker runs in a vm. So you will need to use the vm network adapter names. At best you will shape the vm network when using docker with -net=host. What you are trying to do is pretty much unsupported. You can play around with it, but there is not much support we can give you.

jhaoheng commented 8 years ago

@chantra

Thanks.