Skip to content

Instantly share code, notes, and snippets.

@ninjadq
Created October 12, 2015 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninjadq/4d4c38b0828669e789bb to your computer and use it in GitHub Desktop.
Save ninjadq/4d4c38b0828669e789bb to your computer and use it in GitHub Desktop.
add macvlan to a container
#!/bin/bash
ip link add em1p0 link em2 type macvlan mode bridge
ip link set netns $@ em1p0
nsenter -t $@ -n ip link set em1p0 up
nsenter -t $@ -n ip route del default
nsenter -t $@ -n ip addr add 118.26.188.97/24 dev em1p0
nsenter -t $@ -n ip route add default via 118.26.188.254 dev em1p0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment