Created
May 25, 2017 11:16
-
-
Save anonymous/d4be1d00799cdd4a201a25bee7f53ee9 to your computer and use it in GitHub Desktop.
namespace config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ip netns add app | |
ip link set veth-app netns app | |
host=`hostname` | |
if [ "${host}" == "${CLASSIFIER1_NAME}" ] ; then | |
#setup namespace | |
ip link add veth-app type veth peer name veth-br | |
ovs-vsctl add-port br-sfc veth-br | |
ip link set dev veth-br up | |
#Client IP 51 | |
ip netns add app51 | |
ip link set veth-app netns app51 | |
ip netns exec app51 ifconfig veth-app 192.168.2.51/24 up | |
ip netns exec app51 ip link set dev veth-app addr 10:00:11:11:11:11 | |
ip netns exec app51 arp -s 192.168.2.51 10:00:22:22:22:22 -i veth-app | |
ip netns exec app51 ip link set dev veth-app up | |
ip netns exec app51 ip link set dev lo up | |
ip netns exec app51 ifconfig veth-app mtu 500 | |
ip netns exec app51 ethtool -K veth-app tx off | |
#Client IP 102 | |
ip netns add app102 | |
ip link set veth-app netns app102 | |
ip netns exec app102 ifconfig veth-app 192.168.2.102/24 up | |
ip netns exec app102 ip link set dev veth-app addr 20:00:11:11:11:11 | |
ip netns exec app102 arp -s 192.168.2.102 20:00:22:22:22:22 -i veth-app | |
ip netns exec app102 ip link set dev veth-app up | |
ip netns exec app102 ip link set dev lo up | |
ip netns exec app102 ifconfig veth-app mtu 500 | |
ip netns exec app102 ethtool -K veth-app tx off | |
#Client IP 153 | |
ip netns add app153 | |
ip link set veth-app netns app153 | |
ip netns exec app153 ifconfig veth-app 192.168.2.153/24 up | |
ip netns exec app153 ip link set dev veth-app addr 30:00:11:11:11:11 | |
ip netns exec app153 arp -s 192.168.2.153 30:00:22:22:22:22 -i veth-app | |
ip netns exec app153 ip link set dev veth-app up | |
ip netns exec app153 ip link set dev lo up | |
ip netns exec app153 ifconfig veth-app mtu 500 | |
ip netns exec app153 ethtool -K veth-app tx off | |
#Client IP 204 | |
ip netns add app204 | |
ip link set veth-app netns app204 | |
ip netns exec app204 ifconfig veth-app 192.168.2.204/24 up | |
ip netns exec app204 ip link set dev veth-app addr 40:00:11:11:11:11 | |
ip netns exec app204 arp -s 192.168.2.204 40:00:22:22:22:22 -i veth-app | |
ip netns exec app204 ip link set dev veth-app up | |
ip netns exec app204 ip link set dev lo up | |
ip netns exec app204 ifconfig veth-app mtu 500 | |
ip netns exec app204 ethtool -K veth-app tx off | |
#Client IP 255 | |
ip netns add app255 | |
ip link set veth-app netns app255 | |
ip netns exec app255 ifconfig veth-app 192.168.2.255/24 up | |
ip netns exec app255 ip link set dev veth-app addr 50:00:11:11:11:11 | |
ip netns exec app255 arp -s 192.168.2.255 50:00:22:22:22:22 -i veth-app | |
ip netns exec app255 ip link set dev veth-app up | |
ip netns exec app255 ip link set dev lo up | |
ip netns exec app255 ifconfig veth-app mtu 500 | |
ip netns exec app255 ethtool -K veth-app tx off | |
fi | |
if [ "${host}" == "${CLASSIFIER2_NAME}" ] ; then | |
#setup namespace | |
ip netns add app | |
ip link add veth-app type veth peer name veth-br | |
ovs-vsctl add-port br-sfc veth-br | |
ip link set dev veth-br up | |
ip link set veth-app netns app | |
#setting namespace config | |
ip netns exec app ifconfig veth-app 192.168.2.51/24 up | |
ip netns exec app ip link set dev veth-app addr 00:00:22:22:22:22 | |
ip netns exec app arp -s 192.168.2.1 00:00:11:11:11:11 -i veth-app | |
ip netns exec app ip link set dev veth-app up | |
ip netns exec app ip link set dev lo up | |
ip netns exec app ifconfig veth-app mtu 80000 | |
ip netns exec app ethtool -K veth-app tx off | |
ip netns exec app python3 -m http.server 80 | |
ip netns exec app python3 -m http.server 22 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment