(OK)(OK)(All in CLI) Fedora23 + Docker(busybox) + NS3 + MANETs - testing
来源:互联网 发布:高程测量记录表的算法 编辑:程序博客网 时间:2024/05/17 06:40
#------------------------------------------------------------------------------------------
# (OK)(OK)(All in CLI) Fedora23 + Docker(busybox) + NS3 + MANETs - testing
#------------------------------------------------------------------------------------------
systemctl start docker.service
# docker search image_name
# docker pull image_name
# docker images
# docker rmi image_name
# docker run --privileged -i -t -d --net=none --name docker-$id $docker_image -t $type -i $id
# docker ps
docker run -it --rm --net='none' --name docker-1 busybox /bin/sh
docker run -it --rm --net='none' --name docker-2 busybox /bin/sh
# get PID of CONTAINER
[root@localhost ~]# docker inspect -f "{{.State.Pid}}" docker-1
31321
[root@localhost ~]# docker inspect -f "{{.State.Pid}}" docker-2
31357
# [root@localhost ~]# man ip-netns
# By convention a named network namespace is an object at /var/run/netns/NAME that can be opened. The file
# descriptor resulting from opening /var/run/netns/NAME refers to the specified network namespace. Holding that
# file descriptor open keeps the network namespace alive. The file descriptor can be used with the setns(2) sys‐
# tem call to change the network namespace associated with a task.
#------------------------------------------------------------------------------------------
# https://www.nsnam.org/wiki/HOWTO_Use_Linux_Containers_to_set_up_virtual_networks
# http://yaxin-cn.github.io/Docker/docker-container-use-static-IP.html
#[root@localhost ~]#
brctl addbr br_d_1
brctl addbr br_d_2
ip link add veth_1 type veth peer name X
brctl addif br_d_1 veth_1
ip link set veth_1 up
ip link set X netns 31321
ip link add veth_2 type veth peer name Y
brctl addif br_d_2 veth_2
ip link set veth_2 up
ip link set Y netns 31357
tunctl -t tap_d_1
tunctl -t tap_d_2
ifconfig tap_d_1 0.0.0.0 promisc up
ifconfig tap_d_2 0.0.0.0 promisc up
brctl addif br_d_1 tap_d_1
ifconfig br_d_1 up
brctl addif br_d_2 tap_d_2
ifconfig br_d_2 up
mkdir /var/run/netns
ln -s /proc/31321/ns/net /var/run/netns/31321
ln -s /proc/31357/ns/net /var/run/netns/31357
ip netns exec 31321 ip link set dev X name eth0
ip netns exec 31321 ip link set eth0 up
ip netns exec 31321 ip addr add 172.17.0.1/16 dev eth0
ip netns exec 31357 ip link set dev Y name eth0
ip netns exec 31357 ip link set eth0 up
ip netns exec 31357 ip addr add 172.17.0.2/16 dev eth0
cd /proc/sys/net/bridge
for f in bridge-nf-*; do echo 0 > $f; done
cd -
# ip netns exec 31321 ip route add default via 172.17.42.1
# ip netns exec 31357 ip route add default via 172.17.42.1
# [root@localhost ~]# brctl show
# / # route -n
# You will also have to make sure that your kernel has ethernet filtering (ebtables, bridge-nf, arptables) disabled. If you do not do this, only STP and ARP traffic will be allowed to flow across your bridge and your whole scenario will not work.
#-----------------------
# running NS3
#-----------------------
[root@localhost ~]# cd /opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25
[root@localhost ns-3.25]# gedit scratch/manet-docker.cc
#----------------
TapBridgeHelper tapBridge;
tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));
tapBridge.SetAttribute ("DeviceName", StringValue ("tap_d_1"));
tapBridge.Install (nodes.Get (0), devices.Get (0));
tapBridge.SetAttribute ("DeviceName", StringValue ("tap_d_2"));
tapBridge.Install (nodes.Get (1), devices.Get (1));
#----------------
[root@localhost ns-3.25]# ./waf --run scratch/manet-docker --vis
------------------------------------------------------
172.17.0.2 can ping 172.17.0.1 successfully
------------------------------------------------------
ifconfig br_d_2 down
brctl delif br_d_1 tap_d_1
brctl delif br_d_2 tap_d_2
brctl delbr br_d_1
brctl delbr br_d_2
ifconfig tap_d_1 down
ifconfig tap_d_2 down
tunctl -d tap_d_1
tunctl -d tap_d_2
------------------------------------------------------------------------------------------
So far, OK OK OK
------------------------------------------------------------------------------------------
0 0
- (OK)(OK)(All in CLI) Fedora23 + Docker(busybox) + NS3 + MANETs - testing
- (OK)(OK) Fedora23——NS3(MANETs)——Docker(busybox)——genymotion(android)——All is OK
- (OK) Fedora23—NS3—Docker—MANETs—Testing
- (OK)(OK) Fedora23-NS3-Android-x86-MANETs-Testing
- (OK)(OK)(All in CLI) running two Android-x86 which connect to NS3(MANETs) via "ethernet bridge"
- (OK)(OK) running two Android-x86 in VirtualBox, they connect to NS3(MANETs) via "ethernet bridge"
- (OK) Fedora23——Docker——CORE—testing
- (OK) Fedora23——Docker——CORE—testing
- (OK) 运行cBPM in Fedora23
- (OK) 运行cBPM in Fedora23
- (OK) 运行cBPM in Fedora23
- (OK) install vmware12 in fedora23
- (OK)(OK) SEEM ALL Testing Results
- (OK) 运行cBPM—Fedora23—ALL
- (OK-half) Fedora23——Docker——CORE—testing
- (OK-half) Fedora23——Docker——CORE—testing
- (OK) install-ns3——using-testing
- (OK) IMUNES—Docker—Fedora23
- Pycharm-自动生成代码头内容
- 正负数读入优化模板
- 网页开发基础知识 HTML + CSS
- Struts1 增删改查
- IO-同步,异步,阻塞,非阻塞
- (OK)(OK)(All in CLI) Fedora23 + Docker(busybox) + NS3 + MANETs - testing
- Reverse Vowels of a String 仅翻转元音字符
- mongodb 编译
- itertools实例与生成器代码
- 最小的K个数31
- EAS跳过权限检查
- 172. Factorial Trailing Zeroes
- 使用quartyz2D画圆,并将其三等分
- MS Chart Control - X轴 项目超9项时 Label显示不完全(已解决)