Closed djatnieks closed 9 years ago
Can you try to run with -x
to see exactly which commands does that?
I.E.: `sudo sh -x pipework br1 …"
Thank you!
... And also, are you using the latest version? (#14 has a specific fix for CentOS)
Seems to be "ip link add br1 type bridge" complaining ... can I maybe use 'brctl' instead?
Kinda strange to me cuz I am able to use "ip link add v0 link eth0 type macvlan mode bridge" - so just type bridge is a problem?
$ git pull
Already up-to-date.
$ sudo sh -x pipework br1 high_pare 172.17.6.200/24
+ set -e
+ case "$1" in
+ IFNAME=br1
+ GUESTNAME=high_pare
+ IPADDR=172.17.6.200/24
+ MACADDR=
+ '[' 172.17.6.200/24 ']'
+ '[' -d /sys/class/net/br1 ']'
+ case "$IFNAME" in
+ IFTYPE=bridge
+ read dev mnt fstype options dump fsck
+ '[' rootfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' proc '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' sysfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' devtmpfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' devpts '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' tmpfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' selinuxfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' devtmpfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' usbfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' binfmt_misc '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,cpuset
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,cpu
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,cpuacct
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,memory
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,devices
+ grep -qw devices
+ CGROUPMNT=/cgroup/devices
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,freezer
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,net_cls
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' cgroup '!=' cgroup ']'
+ echo rw,relatime,blkio
+ grep -qw devices
+ continue
+ read dev mnt fstype options dump fsck
+ '[' rpc_pipefs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' nfs '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' ext4 '!=' cgroup ']'
+ continue
+ read dev mnt fstype options dump fsck
+ '[' /cgroup/devices ']'
++ find /cgroup/devices -name high_pare
++ wc -l
+ N=0
+ case "$N" in
+ which docker
++ docker inspect '-format={{.ID}}' high_pare
+ DOCKERID=750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e
+ '[' 750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e = '<no value>' ']'
++ find /cgroup/devices -name 750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e
++ wc -l
+ NN=1
+ case "$NN" in
+ GUESTNAME=750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e
+ '[' 172.17.6.200/24 = dhcp ']'
+ echo 172.17.6.200/24
+ grep -q /
+ echo 172.17.6.200/24
+ grep -q @
+ GATEWAY=
+++ find /cgroup/devices -name 750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e
+++ head -n 1
++ head -n 1 /cgroup/devices/lxc/750913f1596237ae5dc5940e366038de725d91635355099ea8cbcfc06755486e/tasks
+ NSPID=23419
+ '[' 23419 ']'
+ mkdir -p /var/run/netns
+ rm -f /var/run/netns/23419
+ ln -s /proc/23419/ns/net /var/run/netns/23419
+ '[' bridge = bridge ']'
+ '[' '!' -d /sys/class/net/br1 ']'
+ ip link add br1 type bridge
RTNETLINK answers: Operation not supported
Right, it probably needs an alternate implementation using brctl
. Do you see what needs to be done? If you're not too comfortable with brctl
and submitting a patch, I can also work on that, but probably later next week!
The following simple change seemed to work for me:
$ git diff
diff --git a/pipework b/pipework
index 873e23c..11d39fe 100755
--- a/pipework
+++ b/pipework
@@ -137,7 +137,7 @@ ln -s /proc/$NSPID/ns/net /var/run/netns/$NSPID
# Check if we need to create a bridge.
[ $IFTYPE = bridge ] && [ ! -d /sys/class/net/$IFNAME ] && {
- ip link add $IFNAME type bridge
+ brctl addbr $IFNAME type bridge
ip link set $IFNAME up
}
However, after getting past this I ran into another problem with 'ip netns' now working and I needed to upgrade my host kernel to get namespace support. The following helped with that http://spredzy.wordpress.com/2013/11/22/enable-network-namespaces-in-centos-6-4/
e.g.
sudo yum install -y http://rdo.fedorapeople.org/rdo-release.rpm
sudo yum install kernel iproute
So now I was able to run these commands:
sudo sh pipework br1 goofy_wozniak 172.17.6.200/16
sudo ip addr add 172.17.6.200/16 dev br1
I want to be able to ssh into my container using the 172.17.6.200 address, but when I try I end up logged in to the container's host instead of the container. Am I missing something?
I also think I want to set the default gateway so the outbound traffic from the container will come from 172.17.6.200, and the instructions show how to do that, but how does the gateway ip address get setup? I was doing this manually before and I would use brctl/ifconfig as shown on http://docs.docker.io/en/latest/use/networking/. In those instructions it seems that the host brctl/ifconfig is setting the gateway address and the container is assigned an ip address connected to that gateway. What is the equivalent using pipework?
ip link
vs brctl
, I guess I will work on a patch to use whatever is available (some systems don't have brctl
, and on some systems, ip link
won't work).172.17.6.200
) to both the container and the host. You should assign different IP addresses, for instance 172.17.6.200
on the host and 172.17.6.201
on the container.172.17.6.200
and the container 172.17.6.201
, then you can use something like pipework br1 <container_id> 172.17.6.201/16@172.17.6.200
.Closing older issues.
I'm getting this error trying to run pipework - it's not a pipework problem AFAICT, but do you have any ideas? An old Centos kernel or I need a different version of iptables or something? TIA!
(grave_brattain is my container name): sudo ./repos/pipework/pipework br1 grave_brattain 172.17.6.100/24 RTNETLINK answers: Operation not supported
$ uname -a Linux blade-1-4a.dssunnyvale.lan 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
iptables --version iptables v1.4.7
$ sudo docker version Client version: 0.7.2 Go version (client): go1.1.2 Git commit (client): 28b162e/0.7.2 Server version: 0.7.2 Git commit (server): 28b162e/0.7.2 Go version (server): go1.1.2 Last stable version: 0.7.6, please update docker