• (OK)(OK) Fedora23——NS3(MANETs)——Docker(busybox)——genymotion(android)——All is OK



    (OK)(OK) Fedora23——NS3(MANETs)——Docker(busybox)——genymotion(android)——All is OK


    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    set genymotion android —— BEGIN
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    -----------
    in HOST
    -----------
    tunctl -t tap-left
    ip link set up dev tap-left
    brctl addbr br-android
    brctl addif br-android tap-left
    ip link set up dev br-android
    ip addr add 10.1.1.1/24 dev br-android
    ip route add 10.1.1.0/24 dev br-android

    -----------


    [root@localhost genymotion]# pwd
    /opt/genymobile/genymotion
    [root@localhost genymotion]# ./genymotion

    // Virtual Box > Settings > Network > Adapter 2 > bridge, br-android, then, to start android in genymotion window.


    -----------
    in Android
    -----------
    -------------------------------------
    // in HOST
    [root@localhost busybox]# adb push busybox-x86_64 /data
    [root@localhost busybox]# adb shell

    // in Android
    root@vbox86p:/ # cd data/                                                      
    chmod 755 busybox-x86_64
    -------------------------------------
    // in Android

    netcfg eth1 down
    ./busybox-x86_64 ifconfig eth1 down
    ./busybox-x86_64 ifconfig eth1 10.1.1.2 netmask 255.255.255.0 up


    // ./busybox-x86_64 ip addr add 10.1.1.2/24 dev eth1
    // ./busybox-x86_64 ip route add default via 10.1.1.1 dev eth1

    ./busybox-x86_64 route -n
    ./busybox-x86_64 ifconfig
    ./busybox-x86_64 ping 10.1.1.2
    -----------

    -------------------------------------
    ifconfig br-android down
    brctl delif br-android tap-left
    brctl delif br-android eth1
    brctl delbr br-android
    ifconfig tap-left down
    tunctl -d tap-left
    ip link delete veth_android44
    ip link delete X
    -------------------------------------

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    set genymotion android —— END OK
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    set docker busybox —— BEGIN
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    [root@localhost ~]# mkdir /tmp/docker1

    systemctl start docker.service
    systemctl restart docker.service

    cd /tmp/docker1

    [root@localhost docker1]# docker run -it --rm --net='none' busybox /bin/sh

    [root@localhost ~]# docker ps
    CONTAINER ID     IMAGE      COMMAND      CREATED           STATUS          PORTS    NAMES
    9d284828d3a4     busybox    "/bin/sh"    36 seconds ago    Up 35 seconds            loving_goldstine

    //get PID of CONTAINER
    [root@localhost ~]# docker inspect -f "{{.State.Pid}}" loving_goldstine
    32701
    [root@localhost ~]#

    rm /var/run/netns/* -f
    ln -s /proc/32701/ns/net /var/run/netns/32701

    brctl addbr br-docker
    tunctl -t tap-right
    ifconfig tap-right 0.0.0.0 promisc up

    ip link add veth_docker1 type veth peer name Y
    brctl addif br-docker veth_docker1
    ip link set veth_docker1 up
    ip link set Y netns 32701

    brctl addif br-docker tap-right
    ifconfig br-docker up

    brctl show

    ip netns exec 32701 ip link set dev Y name eth0
    ip netns exec 32701 ip link set eth0 up
    ip netns exec 32701 ip addr add 10.1.1.1/24 dev eth0

    cd /proc/sys/net/bridge
    for f in bridge-nf-*; do echo 0 > $f; done
    cd -



    -------------------------------------
    ifconfig br-docker down
    brctl delif br-docker tap-right
    brctl delbr br-docker
    ifconfig tap-right down
    tunctl -d tap-right
    ip link delete veth_docker1
    ip link delete Y
    -------------------------------------

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    set docker busybox —— END OK
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    -----------------------
    running NS3
    -----------------------
    [root@localhost ~]# cd /opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25
    [root@localhost ns-3.25]# ./waf --run scratch/manet-docker --vis

    -----------------------
    docker ping android
    -----------------------
    [root@localhost docker1]# docker run -it --rm --net='none' busybox /bin/sh
    / # ping 10.1.1.2
    PING 10.1.1.2 (10.1.1.2): 56 data bytes
    64 bytes from 10.1.1.2: seq=6 ttl=64 time=187.739 ms
    64 bytes from 10.1.1.2: seq=7 ttl=64 time=92.091 ms
    64 bytes from 10.1.1.2: seq=8 ttl=64 time=27.092 ms
    64 bytes from 10.1.1.2: seq=9 ttl=64 time=29.086 ms

    -----------------------
    android ping docker
    -----------------------
    root@vbox86p:/data # ./busybox-x86_64 ping 10.1.1.1                            
    PING 10.1.1.1 (10.1.1.1): 56 data bytes
    64 bytes from 10.1.1.1: seq=0 ttl=64 time=75.287 ms
    64 bytes from 10.1.1.1: seq=1 ttl=64 time=78.020 ms
    64 bytes from 10.1.1.1: seq=2 ttl=64 time=91.383 ms
    64 bytes from 10.1.1.1: seq=3 ttl=64 time=96.378 ms

    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    So far, All is OK
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  • 相关阅读:
    通过PMP了
    VBA之自动建立连接
    从头学SQL Server2005之一:数据库引擎体系结构
    SMP、NUMA、MPP体系结构介绍【转】
    将Windows2003的RDP客户端管理应用于XP
    VBA中简单修改原有公式的宏
    各种Excel VBA的命令
    领导和管理的区别在哪里?【转】
    COM(VB/VBA/Script)利用服务标记调用WCF服务之四:使用配置文件
    2009年第一篇日志
  • 原文地址:https://www.cnblogs.com/ztguang/p/12646576.html
Copyright © 2020-2023  润新知