Created
April 14, 2019 10:57
-
-
Save adventureloop/3441c8ebe8405282cc4d47bacc949f26 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| create bridge to physical interface | |
| ip link add name bridge0 type bridge | |
| ip link set bridge0 up | |
| ip link show | |
| ip link set enp0s2 master bridge0 | |
| create epair | |
| ip link add outside type veth peer name inside | |
| ip link set outside up | |
| ip link set outside master bridge0 | |
| create netns | |
| ip netns add ns1 | |
| # add loopback to it | |
| ip netns exec ns1 ip link set dev lo up | |
| delegate half epair into netns | |
| ip link set inside netns ns1 | |
| add tc qdisc to epair | |
| tc qdisc add dev outside root netem delay 200ms rate 1024kbit | |
| config an address inside the ns | |
| ip netns exec ns1 dhclient inside | |
| run ping google.com in netns | |
| ip netns exec ns1 ping 8.8.8.8 | |
| tidy up | |
| tc qdisc del dev outside root | |
| ip netns del ns1 | |
| ip link del bridge0 | |
| ip link del outside |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment