def setup_ethdown(interface_l): for intf in interface_l: do_ssh(client_eth0, ssh_port, "ifdown " + intf) do_ssh(server_eth0, ssh_port, "ifdown " + intf)
def setup_initial_service(): do_ssh(client_eth0, ssh_port, "systemctl disable firewalld") do_ssh(client_eth0, ssh_port, "systemctl stop firewalld") do_ssh(client_eth0, ssh_port, "systemctl start iptables") do_ssh(client_eth0, ssh_port, "systemctl start httpd") do_ssh(router_eth0, ssh_port, "systemctl disable firewalld") do_ssh(router_eth0, ssh_port, "systemctl stop firewalld") do_ssh(router_eth0, ssh_port, "systemctl start iptables") do_ssh(router_eth0, ssh_port, "systemctl start httpd") do_ssh(server_eth0, ssh_port, "systemctl disable firewalld") do_ssh(server_eth0, ssh_port, "systemctl stop firewalld") do_ssh(server_eth0, ssh_port, "systemctl start iptables") do_ssh(server_eth0, ssh_port, "systemctl start httpd")
def debug_setup(): do_ssh(client_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_debug=1") do_ssh(router_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_debug=1") do_ssh(server_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_debug=1")
def network_default_setup(): #client do_ssh(client_eth0, ssh_port, "ip rule add from 10.1.1.1 table 1") do_ssh(client_eth0, ssh_port, "ip route add 10.1.1.0/24 dev eth1 scope link table 1") do_ssh(client_eth0, ssh_port, "ip route add 10.2.1.0/24 via 10.1.1.2") do_ssh(client_eth0, ssh_port, "ip route add default via 10.1.1.2 dev eth1 table 1") do_ssh(client_eth0, ssh_port, "ip rule add from 10.1.2.1 table 2") do_ssh(client_eth0, ssh_port, "ip route add 10.1.2.0/24 dev eth2 scope link table 2") do_ssh(client_eth0, ssh_port, "ip route add 10.2.2.0/24 via 10.1.2.2") do_ssh(client_eth0, ssh_port, "ip route add default via 10.1.2.2 dev eth2 table 2") # router do_ssh(router_eth0, ssh_port, "sysctl net.ipv4.ip_forward=1") # router as a NAT # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.1.1.0/24 -j MASQUERADE") # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.1.2.0/24 -j MASQUERADE") # # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.2.1.0/24 -j MASQUERADE") # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.2.2.0/24 -j MASQUERADE") # server do_ssh(server_eth0, ssh_port, "ip rule add from 10.2.1.1 table 1") do_ssh(server_eth0, ssh_port, "ip route add 10.2.1.0/24 dev eth1 scope link table 1") do_ssh(server_eth0, ssh_port, "ip route add 10.1.1.0/24 via 10.2.1.2") do_ssh(server_eth0, ssh_port, "ip route add default via 10.2.1.2 dev eth1 table 1") do_ssh(server_eth0, ssh_port, "ip rule add from 10.2.2.1 table 2") do_ssh(server_eth0, ssh_port, "ip route add 10.2.2.0/24 dev eth2 scope link table 2") do_ssh(server_eth0, ssh_port, "ip route add 10.1.2.0/24 via 10.2.2.2") do_ssh(server_eth0, ssh_port, "ip route add default via 10.2.2.2 dev eth2 table 2")
def setup_path_manager(manager_type): do_ssh(client_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_path_manager=" + manager_type) do_ssh(router_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_path_manager=" + manager_type) do_ssh(server_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_path_manager=" + manager_type) if manager_type == "ndiffports": do_ssh(client_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_ndiffports=10") do_ssh(router_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_ndiffports=20") do_ssh(server_eth0, ssh_port, "sysctl -w net.mptcp.mptcp_ndiffports=10")
def network_default_setup(): # client do_ssh(client_eth0, ssh_port, "ip rule add from 10.1.1.1 table 1") do_ssh(client_eth0, ssh_port, "ip route add 10.1.1.0/24 dev eth1 scope link table 1") do_ssh(client_eth0, ssh_port, "ip route add 10.2.1.0/24 via 10.1.1.2") do_ssh(client_eth0, ssh_port, "ip route add default via 10.1.1.2 dev eth1 table 1") do_ssh(client_eth0, ssh_port, "ip rule add from 10.1.2.1 table 2") do_ssh(client_eth0, ssh_port, "ip route add 10.1.2.0/24 dev eth2 scope link table 2") do_ssh(client_eth0, ssh_port, "ip route add 10.2.2.0/24 via 10.1.2.2") do_ssh(client_eth0, ssh_port, "ip route add default via 10.1.2.2 dev eth2 table 2") # router do_ssh(router_eth0, ssh_port, "sysctl net.ipv4.ip_forward=1") # router as a NAT # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.1.1.0/24 -j MASQUERADE") # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.1.2.0/24 -j MASQUERADE") # # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.2.1.0/24 -j MASQUERADE") # do_ssh(router_eth0, ssh_port, "iptables -t nat -A POSTROUTING -s 10.2.2.0/24 -j MASQUERADE") # server do_ssh(server_eth0, ssh_port, "ip rule add from 10.2.1.1 table 1") do_ssh(server_eth0, ssh_port, "ip route add 10.2.1.0/24 dev eth1 scope link table 1") do_ssh(server_eth0, ssh_port, "ip route add 10.1.1.0/24 via 10.2.1.2") do_ssh(server_eth0, ssh_port, "ip route add default via 10.2.1.2 dev eth1 table 1") do_ssh(server_eth0, ssh_port, "ip rule add from 10.2.2.1 table 2") do_ssh(server_eth0, ssh_port, "ip route add 10.2.2.0/24 dev eth2 scope link table 2") do_ssh(server_eth0, ssh_port, "ip route add 10.1.2.0/24 via 10.2.2.2") do_ssh(server_eth0, ssh_port, "ip route add default via 10.2.2.2 dev eth2 table 2")