update scripts
This commit is contained in:
parent
eb97ca67da
commit
3e1acd6282
83
Blatt02/scripts/101.sh
Normal file
83
Blatt02/scripts/101.sh
Normal file
@ -0,0 +1,83 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "reboot to erase the old configurations;"
|
||||
bash ~/reboot.sh
|
||||
echo "rebooting"
|
||||
countdown=40
|
||||
while [ $countdown -gt 0 ]; do
|
||||
echo -ne "counting down: $countdown s \033[0K\r"
|
||||
sleep 1
|
||||
countdown=$((countdown - 1))
|
||||
done
|
||||
|
||||
assign_ip(){
|
||||
local dev=$1
|
||||
local eth_num=$2
|
||||
local ip=$3
|
||||
ssh $dev "ip link set dev eth$eth_num up"
|
||||
ssh $dev "ip addr add $ip dev eth$eth_num"
|
||||
echo "dev $dev eth$eth_num assign $ip"
|
||||
}
|
||||
|
||||
assign_br(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local ip_nocode=$3
|
||||
ssh $dev "ip link add name br0 type bridge"
|
||||
ssh $dev "ip link set dev br0 up"
|
||||
ssh $dev "ip address add $ip dev br0"
|
||||
ssh $dev "ip route append default via $ip_nocode dev br0"
|
||||
}
|
||||
|
||||
turn_up(){
|
||||
local dev=$1
|
||||
local eth_num1=$2
|
||||
local eth_num2=$3
|
||||
local eth_num3=$4
|
||||
ssh $dev "ip link set eth$eth_num1 up"
|
||||
ssh $dev "ip link set eth$eth_num1 master br0"
|
||||
ssh $dev "ip link set eth$eth_num2 up"
|
||||
ssh $dev "ip link set eth$eth_num2 master br0"
|
||||
ssh $dev "ip link set eth$eth_num3 up"
|
||||
ssh $dev "ip link set eth$eth_num3 master br0"
|
||||
}
|
||||
|
||||
ping_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
ssh $dev "which ping"
|
||||
local cmd="ping -c 5 -W 2 -I eth$eth_n $ip"
|
||||
echo $cmd
|
||||
ssh "$dev" $cmd
|
||||
}
|
||||
|
||||
assign_ip "pc1" 1 "10.5.1.1/24"
|
||||
|
||||
assign_ip "pc2" 1 "10.5.1.2/24"
|
||||
|
||||
assign_ip "pc3" 1 "10.5.1.3/24"
|
||||
|
||||
|
||||
assign_ip "router4" 1 "10.5.1.4/24"
|
||||
|
||||
|
||||
assign_br "router1" "10.5.1.5/24" "10.5.1.5"
|
||||
turn_up "router1" 1 3 4
|
||||
|
||||
assign_br "router2" "10.5.1.5/24" "10.5.1.5"
|
||||
turn_up "router2" 1 3 4
|
||||
|
||||
assign_br "router3" "10.5.1.6/24" "10.5.1.6"
|
||||
turn_up "router3" 1 2 3
|
||||
|
||||
ping_dev "pc1" "10.5.1.3" "1"
|
||||
ping_dev "router4" "10.5.1.3" "1"
|
||||
ping_dev "router4" "10.5.1.1" "1"
|
||||
ping_dev "router4" "10.5.1.2" "1"
|
||||
ping_dev "pc1" "10.5.1.4" "1"
|
||||
ping_dev "pc2" "10.5.1.4" "1"
|
||||
ping_dev "pc3" "10.5.1.4" "1"
|
||||
|
||||
|
||||
|
@ -26,6 +26,8 @@ ping_dev(){
|
||||
local eth_n=$3
|
||||
# ssh "$dev" $cmd
|
||||
loss=$(ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip | awk -F', ' '/packet loss/ {print \$3}' | awk '{print int(\$1)}'")
|
||||
output=$(ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo $output > 2/output/"${dev}_${ip}_${eth_n}"
|
||||
echo $loss
|
||||
}
|
||||
|
||||
|
67
Blatt02/scripts/201.sh
Normal file
67
Blatt02/scripts/201.sh
Normal file
@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash /home/rnp/2/103.sh
|
||||
clear
|
||||
echo "************************************************************"
|
||||
bash /home/rnp/checkip.sh
|
||||
echo "************************************************************"
|
||||
echo "201" > /home/rnp/2/201.txt
|
||||
del_vlan(){
|
||||
local dev=$1
|
||||
local eth_v=$2
|
||||
local eth_p=$3
|
||||
local ip=$4
|
||||
ssh $dev "ip link delete $eth_v"
|
||||
ssh $dev "ip link set dev $eth_p up"
|
||||
ssh $dev "ip addr add $ip dev $eth_p"
|
||||
}
|
||||
|
||||
del_vlan "router4" "eth1.100" "eth1" "10.5.1.4/24"
|
||||
del_vlan "pc1" "eth1.200" "eth1" "10.5.1.1/24"
|
||||
del_vlan "pc2" "eth1.200" "eth1" "10.5.1.2/24"
|
||||
del_vlan "pc3" "eth1.100" "eth1" "10.5.1.3/24"
|
||||
|
||||
|
||||
assign_ip(){
|
||||
local dev=$1
|
||||
local eth=$2
|
||||
local ip=$3
|
||||
ssh $dev "ip addr add $ip dev $eth"
|
||||
}
|
||||
|
||||
echo "============================================================"
|
||||
bash /home/rnp/checkip.sh
|
||||
echo "============================================================"
|
||||
|
||||
|
||||
echo "pc1 neigh"
|
||||
ssh pc1 "ip neigh"
|
||||
echo "pc2 neigh"
|
||||
ssh pc2 "ip neigh"
|
||||
|
||||
echo "pc1 neigh" >> /home/rnp/2/201.txt
|
||||
ssh pc1 "ip neigh" >> /home/rnp/2/201.txt
|
||||
echo "pc2 neigh" >> /home/rnp/2/201.txt
|
||||
ssh pc2 "ip neigh" >> /home/rnp/2/201.txt
|
||||
|
||||
ping_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip"
|
||||
}
|
||||
|
||||
ping_dev "pc1" "10.5.1.2" 1
|
||||
ping_dev "pc1" "10.5.1.3" 1
|
||||
ping_dev "pc1" "10.5.1.4" 1
|
||||
|
||||
ping_dev "pc2" "10.5.1.1" 1
|
||||
ping_dev "pc2" "10.5.1.3" 1
|
||||
ping_dev "pc2" "10.5.1.4" 1
|
||||
|
||||
echo "pc1 neigh-2" >> /home/rnp/2/201.txt
|
||||
ssh pc1 "ip neigh" >> /home/rnp/2/201.txt
|
||||
echo "pc2 neigh-2" >> /home/rnp/2/201.txt
|
||||
ssh pc2 "ip neigh" >> /home/rnp/2/201.txt
|
||||
|
||||
|
15
Blatt02/scripts/201.txt
Normal file
15
Blatt02/scripts/201.txt
Normal file
@ -0,0 +1,15 @@
|
||||
201
|
||||
pc1 neigh
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff DELAY
|
||||
pc2 neigh
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff DELAY
|
||||
pc1 neigh-2
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
|
||||
10.5.1.2 dev eth1 lladdr 00:16:3e:00:00:04 STALE
|
||||
10.5.1.3 dev eth1 lladdr 00:16:3e:00:00:06 REACHABLE
|
||||
10.5.1.4 dev eth1 lladdr 00:16:3e:00:00:23 REACHABLE
|
||||
pc2 neigh-2
|
||||
10.5.1.3 dev eth1 lladdr 00:16:3e:00:00:06 REACHABLE
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
|
||||
10.5.1.1 dev eth1 lladdr 00:16:3e:00:00:02 STALE
|
||||
10.5.1.4 dev eth1 lladdr 00:16:3e:00:00:23 REACHABLE
|
25
Blatt02/scripts/202.sh
Normal file
25
Blatt02/scripts/202.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash /home/rnp/2/201.sh
|
||||
|
||||
echo "flush pc1 neigh"
|
||||
echo "ip neigh flush all"
|
||||
output=$(ssh pc1 "ip neigh flush all")
|
||||
echo $output > /home/rnp/2/202.txt
|
||||
echo $output
|
||||
output=$(ssh pc1 "ip neigh")
|
||||
echo $output
|
||||
echo $output >> /home/rnp/2/202.txt
|
||||
|
||||
echo "flush pc2 neigh"
|
||||
echo "ip neigh flush all"
|
||||
output=$(ssh pc2 "ip neigh flush all")
|
||||
echo $output
|
||||
echo $output >> /home/rnp/2/202.txt
|
||||
output=$(ssh pc2 "ip neigh")
|
||||
echo $output
|
||||
echo $output >> /home/rnp/2/202.txt
|
||||
|
||||
|
||||
|
||||
|
4
Blatt02/scripts/202.txt
Normal file
4
Blatt02/scripts/202.txt
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
|
||||
|
||||
192.168.0.254 dev eth0 lladdr fe:ff:ff:ff:ff:ff REACHABLE
|
16
Blatt02/scripts/203.sh
Normal file
16
Blatt02/scripts/203.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash /home/rnp/2/202.sh
|
||||
|
||||
echo "203" > /home/rnp/203.txt
|
||||
|
||||
for i in {1..3}; do
|
||||
echo "pc$i ipv6"
|
||||
output=$(ssh pc$i "ip -6 addr show")
|
||||
echo "ip -6 addr show" >> /home/rnp/2/203.txt
|
||||
echo "ip -6 addr show"
|
||||
echo "$output" >> /home/rnp/2/203.txt
|
||||
echo "$output"
|
||||
done
|
||||
|
||||
|
168
Blatt02/scripts/203.txt
Normal file
168
Blatt02/scripts/203.txt
Normal file
@ -0,0 +1,168 @@
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:1/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:3/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
||||
ip -6 addr show
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
|
||||
inet6 ::1/128 scope host
|
||||
valid_lft forever preferred_lft forever
|
||||
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
|
||||
inet6 fe80::216:3eff:fe00:5/64 scope link
|
||||
valid_lft forever preferred_lft forever
|
75
Blatt02/scripts/204.sh
Normal file
75
Blatt02/scripts/204.sh
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
|
||||
bash /home/rnp/2/203.sh
|
||||
|
||||
get_v6(){
|
||||
local output=$1
|
||||
local eth_n=$2
|
||||
echo "$output" | grep -A 1 "^[0-9]: eth$eth_n" | awk '/inet6/ {split($2, parts, "/"); print parts[1]}'
|
||||
}
|
||||
|
||||
pc1_ip6=$(ssh "pc1" "ip -6 addr show")
|
||||
pc1_ip6=$(ssh "pc1" "ip link set dev eth1 down")
|
||||
pc1_ip6=$(ssh "pc1" "ip link set dev eth1 up")
|
||||
pc1_ip6=$(ssh "pc1" "ip -6 addr show")
|
||||
echo $pc1_ip6
|
||||
pc1_6=$(get_v6 "$pc1_ip6" 1)
|
||||
echo $pc1_6
|
||||
|
||||
pc2_ip6=$(ssh "pc2" "ip -6 addr show")
|
||||
pc2_ip6=$(ssh "pc2" "ip link set dev eth1 down")
|
||||
pc2_ip6=$(ssh "pc2" "ip link set dev eth1 up")
|
||||
pc2_ip6=$(ssh "pc2" "ip -6 addr show")
|
||||
echo $pc2_ip6
|
||||
pc2_6=$(get_v6 "$pc2_ip6" 1)
|
||||
echo $pc2_6
|
||||
|
||||
echo "using ping"
|
||||
echo "using ping" > /home/rnp/2/204.txt
|
||||
|
||||
ping_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
local output=$(ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo $output
|
||||
}
|
||||
|
||||
ping6_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
local output=$(ssh $dev "ping6 -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo $output
|
||||
}
|
||||
output=$(ping_dev "pc1" "10.5.1.2" 1)
|
||||
echo "pc1 ping pc2"
|
||||
echo "pc1 ping pc2">> /home/rnp/2/204.txt
|
||||
echo "ping -c 5 -W 2 -I eth1 10.5.1.2"
|
||||
echo "ping -c 5 -W 2 -I eth1 10.5.1.2">> /home/rnp/2/204.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/204.txt
|
||||
|
||||
output=$(ping_dev "pc2" "10.5.1.1" 1)
|
||||
echo "pc2 ping pc1"
|
||||
echo "pc2 ping pc1">> /home/rnp/2/204.txt
|
||||
echo "ping -c 5 -W 2 -I eth1 10.5.1.1"
|
||||
echo "ping -c 5 -W 2 -I eth1 10.5.1.1">> /home/rnp/2/204.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/204.txt
|
||||
|
||||
output=$(ping6_dev "pc1" "$pc2_6" 1)
|
||||
echo "pc1 ping6 pc2"
|
||||
echo "pc1 ping6 pc2">> /home/rnp/2/204.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6">> /home/rnp/2/204.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/204.txt
|
||||
|
||||
output=$(ping6_dev "pc2" "$pc1_6" 1)
|
||||
echo "pc2 ping6 pc1"
|
||||
echo "pc2 ping6 pc1">> /home/rnp/2/204.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6">> /home/rnp/2/204.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/204.txt
|
13
Blatt02/scripts/204.txt
Normal file
13
Blatt02/scripts/204.txt
Normal file
@ -0,0 +1,13 @@
|
||||
using ping
|
||||
pc1 ping pc2
|
||||
ping -c 5 -W 2 -I eth1 10.5.1.2
|
||||
PING 10.5.1.2 (10.5.1.2) from 10.5.1.1 eth1: 56(84) bytes of data. 64 bytes from 10.5.1.2: icmp_seq=1 ttl=64 time=1.87 ms 64 bytes from 10.5.1.2: icmp_seq=2 ttl=64 time=0.707 ms 64 bytes from 10.5.1.2: icmp_seq=3 ttl=64 time=0.664 ms 64 bytes from 10.5.1.2: icmp_seq=4 ttl=64 time=0.689 ms 64 bytes from 10.5.1.2: icmp_seq=5 ttl=64 time=1.02 ms --- 10.5.1.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4068ms rtt min/avg/max/mdev = 0.664/0.991/1.874/0.460 ms
|
||||
pc2 ping pc1
|
||||
ping -c 5 -W 2 -I eth1 10.5.1.1
|
||||
PING 10.5.1.1 (10.5.1.1) from 10.5.1.2 eth1: 56(84) bytes of data. 64 bytes from 10.5.1.1: icmp_seq=1 ttl=64 time=0.714 ms 64 bytes from 10.5.1.1: icmp_seq=2 ttl=64 time=0.749 ms 64 bytes from 10.5.1.1: icmp_seq=3 ttl=64 time=1.90 ms 64 bytes from 10.5.1.1: icmp_seq=4 ttl=64 time=0.824 ms 64 bytes from 10.5.1.1: icmp_seq=5 ttl=64 time=0.845 ms --- 10.5.1.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4049ms rtt min/avg/max/mdev = 0.714/1.005/1.896/0.447 ms
|
||||
pc1 ping6 pc2
|
||||
ping6 -c 5 -W 2 -I eth1 fe80::216:3eff:fe00:4/64
|
||||
|
||||
pc2 ping6 pc1
|
||||
ping6 -c 5 -W 2 -I eth1 fe80::216:3eff:fe00:2/64
|
||||
|
68
Blatt02/scripts/205.sh
Normal file
68
Blatt02/scripts/205.sh
Normal file
@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
run204=$1
|
||||
ping_type=$2
|
||||
if [ "$run204" = "y" ]; then
|
||||
bash /home/rnp/2/204.sh
|
||||
fi
|
||||
echo "205" > /home/rnp/2/205.txt
|
||||
|
||||
get_v6(){
|
||||
local output=$1
|
||||
local eth_n=$2
|
||||
echo "$output" | grep -A 1 "^[0-9]: eth$eth_n" | awk '/inet6/ {split($2, parts, "/"); print parts[1]}'
|
||||
}
|
||||
|
||||
pc1_ip6=$(ssh "pc1" "ip -6 addr show")
|
||||
pc1_6=$(get_v6 "$pc1_ip6" 1)
|
||||
echo $pc1_6
|
||||
echo -e $pc1_ip6 >> /home/rnp/2/205.txt
|
||||
|
||||
pc2_ip6=$(ssh "pc2" "ip -6 addr show")
|
||||
pc2_6=$(get_v6 "$pc2_ip6" 1)
|
||||
echo -e $pc2_6 >> /home/rnp/2/205.txt
|
||||
|
||||
ping6_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
local output=$(ssh $dev "ping6 -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo -e $output
|
||||
}
|
||||
|
||||
ping_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
# ssh "$dev" $cmd
|
||||
loss=$(ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip | awk -F', ' '/packet loss/ {print \$3}' | awk '{print int(\$1)}'")
|
||||
output=$(ssh $dev "ping -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo -e $output > 2/output/"${dev}_${ip}_${eth_n}"
|
||||
echo $loss
|
||||
}
|
||||
|
||||
echo "using ping"
|
||||
echo "using ping" >> /home/rnp/2/205.txt
|
||||
|
||||
|
||||
if [ $ping_type -eq 4 ]; then
|
||||
output=$(ping_dev "pc1" "10.5.1.2" 1)
|
||||
echo $output
|
||||
echo $output >> /home/rnp/2/205.txt
|
||||
|
||||
output=$(ping_dev "pc2" "10.5.1.1" 1)
|
||||
echo $output
|
||||
echo $output >> /home/rnp/2/205.txt
|
||||
elif [ $ping_type -eq 6 ]; then
|
||||
echo "$pc2_6"
|
||||
output=$(ping6_dev "pc1" "$pc2_6" 1)
|
||||
echo -e $output
|
||||
echo -e $output >> /home/rnp/2/205.txt
|
||||
|
||||
output=$(ping6_dev "pc2" "$pc1_6" 1)
|
||||
echo "$pc1_6"
|
||||
echo -e $output
|
||||
echo -e $output >> /home/rnp/2/205.txt
|
||||
fi
|
||||
|
||||
|
6
Blatt02/scripts/205.txt
Normal file
6
Blatt02/scripts/205.txt
Normal file
@ -0,0 +1,6 @@
|
||||
205
|
||||
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000 inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 inet6 fe80::216:3eff:fe00:1/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 inet6 fe80::216:3eff:fe00:2/64 scope link valid_lft forever preferred_lft forever
|
||||
fe80::216:3eff:fe00:4
|
||||
using ping
|
||||
PING fe80::216:3eff:fe00:4(fe80::216:3eff:fe00:4) from :: eth1: 56 data bytes 64 bytes from fe80::216:3eff:fe00:4%eth1: icmp_seq=1 ttl=64 time=2.03 ms 64 bytes from fe80::216:3eff:fe00:4%eth1: icmp_seq=2 ttl=64 time=0.807 ms 64 bytes from fe80::216:3eff:fe00:4%eth1: icmp_seq=3 ttl=64 time=0.942 ms 64 bytes from fe80::216:3eff:fe00:4%eth1: icmp_seq=4 ttl=64 time=0.893 ms 64 bytes from fe80::216:3eff:fe00:4%eth1: icmp_seq=5 ttl=64 time=0.771 ms --- fe80::216:3eff:fe00:4 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 0.771/1.089/2.033/0.475 ms
|
||||
PING fe80::216:3eff:fe00:2(fe80::216:3eff:fe00:2) from :: eth1: 56 data bytes 64 bytes from fe80::216:3eff:fe00:2%eth1: icmp_seq=1 ttl=64 time=0.944 ms 64 bytes from fe80::216:3eff:fe00:2%eth1: icmp_seq=2 ttl=64 time=0.823 ms 64 bytes from fe80::216:3eff:fe00:2%eth1: icmp_seq=3 ttl=64 time=0.778 ms 64 bytes from fe80::216:3eff:fe00:2%eth1: icmp_seq=4 ttl=64 time=0.823 ms 64 bytes from fe80::216:3eff:fe00:2%eth1: icmp_seq=5 ttl=64 time=0.769 ms --- fe80::216:3eff:fe00:2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 0.769/0.827/0.944/0.062 ms
|
60
Blatt02/scripts/206.sh
Normal file
60
Blatt02/scripts/206.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
run205=$1
|
||||
if [ "$run205" = "y" ]; then
|
||||
bash /home/rnp/2/205.sh y 4
|
||||
fi
|
||||
echo "206" > /home/rnp/2/206.txt
|
||||
|
||||
assign_ip(){
|
||||
local dev=$1
|
||||
local eth_num=$2
|
||||
local ip=$3
|
||||
ssh $dev "ip link set dev eth$eth_num up"
|
||||
ssh $dev "ip addr add $ip dev eth$eth_num"
|
||||
echo "dev $dev eth$eth_num assign $ip"
|
||||
}
|
||||
|
||||
assign_ip "pc1" 1 "2001:db8:5::1/64"
|
||||
assign_ip "pc2" 1 "2001:db8:5::2/64"
|
||||
|
||||
get_v6(){
|
||||
local output=$1
|
||||
local eth_n=$2
|
||||
echo "$output" | grep -A 1 "^[0-9]: eth$eth_n" | awk '/inet6/ && /global/ {split($2, a, "/"); print a[1]}'
|
||||
}
|
||||
|
||||
ping6_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
local output=$(ssh $dev "ping6 -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo $output
|
||||
}
|
||||
|
||||
pc1_ip6=$(ssh "pc1" "ip -6 addr show")
|
||||
echo $pc1_ip6
|
||||
pc1_6=$(get_v6 "$pc1_ip6" 1)
|
||||
echo $pc1_6
|
||||
|
||||
pc2_ip6=$(ssh "pc2" "ip -6 addr show")
|
||||
echo $pc2_ip6
|
||||
pc2_6=$(get_v6 "$pc2_ip6" 1)
|
||||
echo $pc2_6
|
||||
|
||||
output=$(ping6_dev "pc1" "$pc2_6" 1)
|
||||
echo "pc1 ping6 pc2"
|
||||
echo "pc1 ping6 pc2">> /home/rnp/2/206.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6">> /home/rnp/2/206.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/206.txt
|
||||
|
||||
output=$(ping6_dev "pc2" "$pc1_6" 1)
|
||||
echo "pc2 ping6 pc1"
|
||||
echo "pc2 ping6 pc1">> /home/rnp/2/206.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6">> /home/rnp/2/206.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/206.txt
|
||||
|
7
Blatt02/scripts/206.txt
Normal file
7
Blatt02/scripts/206.txt
Normal file
@ -0,0 +1,7 @@
|
||||
206
|
||||
pc1 ping6 pc2
|
||||
ping6 -c 5 -W 2 -I eth1 2001:db8:5::2
|
||||
PING 2001:db8:5::2(2001:db8:5::2) from 2001:db8:5::1 eth1: 56 data bytes 64 bytes from 2001:db8:5::2: icmp_seq=1 ttl=64 time=0.811 ms 64 bytes from 2001:db8:5::2: icmp_seq=2 ttl=64 time=1.26 ms 64 bytes from 2001:db8:5::2: icmp_seq=3 ttl=64 time=1.75 ms 64 bytes from 2001:db8:5::2: icmp_seq=4 ttl=64 time=1.35 ms 64 bytes from 2001:db8:5::2: icmp_seq=5 ttl=64 time=1.41 ms --- 2001:db8:5::2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4006ms rtt min/avg/max/mdev = 0.811/1.313/1.748/0.301 ms
|
||||
pc2 ping6 pc1
|
||||
ping6 -c 5 -W 2 -I eth1 2001:db8:5::1
|
||||
PING 2001:db8:5::1(2001:db8:5::1) from 2001:db8:5::2 eth1: 56 data bytes 64 bytes from 2001:db8:5::1: icmp_seq=1 ttl=64 time=1.63 ms 64 bytes from 2001:db8:5::1: icmp_seq=2 ttl=64 time=1.58 ms 64 bytes from 2001:db8:5::1: icmp_seq=3 ttl=64 time=1.48 ms 64 bytes from 2001:db8:5::1: icmp_seq=4 ttl=64 time=1.60 ms 64 bytes from 2001:db8:5::1: icmp_seq=5 ttl=64 time=1.63 ms --- 2001:db8:5::1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4008ms rtt min/avg/max/mdev = 1.477/1.582/1.630/0.056 ms
|
60
Blatt02/scripts/207.sh
Normal file
60
Blatt02/scripts/207.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
|
||||
run205=$1
|
||||
if [ "$run205" = "y" ]; then
|
||||
bash /home/rnp/2/205.sh y 4
|
||||
fi
|
||||
echo "206" > /home/rnp/2/206.txt
|
||||
|
||||
assign_ip(){
|
||||
local dev=$1
|
||||
local eth_num=$2
|
||||
local ip=$3
|
||||
ssh $dev "ip link set dev eth$eth_num up"
|
||||
ssh $dev "ip addr add $ip dev eth$eth_num"
|
||||
echo "dev $dev eth$eth_num assign $ip"
|
||||
}
|
||||
|
||||
assign_ip "pc1" 1 "2001:db8:5::1/64"
|
||||
assign_ip "pc2" 1 "2001:db8:5::2/64"
|
||||
|
||||
get_v6(){
|
||||
local output=$1
|
||||
local eth_n=$2
|
||||
echo "$output" | grep -A 1 "^[0-9]: eth$eth_n" | awk '/inet6/ && /global/ {split($2, a, "/"); print a[1]}'
|
||||
}
|
||||
|
||||
ping6_dev(){
|
||||
local dev=$1
|
||||
local ip=$2
|
||||
local eth_n=$3
|
||||
local output=$(ssh $dev "ping6 -c 5 -W 2 -I eth$eth_n $ip")
|
||||
echo $output
|
||||
}
|
||||
|
||||
pc1_ip6=$(ssh "pc1" "ip -6 addr show")
|
||||
echo $pc1_ip6
|
||||
pc1_6=$(get_v6 "$pc1_ip6" 1)
|
||||
echo $pc1_6
|
||||
|
||||
pc2_ip6=$(ssh "pc2" "ip -6 addr show")
|
||||
echo $pc2_ip6
|
||||
pc2_6=$(get_v6 "$pc2_ip6" 1)
|
||||
echo $pc2_6
|
||||
|
||||
output=$(ping6_dev "pc1" "$pc2_6" 1)
|
||||
echo "pc1 ping6 pc2"
|
||||
echo "pc1 ping6 pc2">> /home/rnp/2/206.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc2_6">> /home/rnp/2/206.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/206.txt
|
||||
|
||||
output=$(ping6_dev "pc2" "$pc1_6" 1)
|
||||
echo "pc2 ping6 pc1"
|
||||
echo "pc2 ping6 pc1">> /home/rnp/2/206.txt
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6"
|
||||
echo "ping6 -c 5 -W 2 -I eth1 $pc1_6">> /home/rnp/2/206.txt
|
||||
echo "$output"
|
||||
echo "$output" >> /home/rnp/2/206.txt
|
||||
|
6
Blatt02/scripts/208.py
Normal file
6
Blatt02/scripts/208.py
Normal file
@ -0,0 +1,6 @@
|
||||
from scapy.all import *
|
||||
|
||||
def packet_callback(packet):
|
||||
print(packet.summary())
|
||||
|
||||
sniff(iface="eth1", prn=packet_callback, count=10)
|
12
Blatt02/scripts/209.py
Normal file
12
Blatt02/scripts/209.py
Normal file
@ -0,0 +1,12 @@
|
||||
from scapy.all import *
|
||||
|
||||
def display_arp(packet):
|
||||
if packet.haslayer(ICMPv6ND_NS):
|
||||
print("NS Packet:")
|
||||
print("Source MAC", packet[Ether].hwsrc)
|
||||
print("Source IP", packet[IPv6].psrc)
|
||||
print("Target IP", packet[ICMPv6ND_NS].tgt)
|
||||
print("="*30)
|
||||
|
||||
sniff(iface="eth1", prn=display_arp, store=0)
|
||||
|
@ -20,43 +20,43 @@ assign_ip(){
|
||||
|
||||
echo "assigning IP on router1"
|
||||
|
||||
assign_ip "router1" 1 "10.5.1.2"
|
||||
assign_ip "router1" 2 "10.5.3.3"
|
||||
assign_ip "router1" 3 "10.5.4.2"
|
||||
assign_ip "router1" 4 "10.5.2.3"
|
||||
assign_ip "router1" 1 "10.5.1.2/24"
|
||||
assign_ip "router1" 2 "10.5.3.3/24"
|
||||
assign_ip "router1" 3 "10.5.4.2/24"
|
||||
assign_ip "router1" 4 "10.5.2.3/24"
|
||||
|
||||
|
||||
echo "assigning IP on router2"
|
||||
|
||||
assign_ip "router2" 1 "10.5.2.2"
|
||||
assign_ip "router2" 2 "10.5.3.4"
|
||||
assign_ip "router2" 3 "10.5.4.5"
|
||||
assign_ip "router2" 4 "10.5.5.5"
|
||||
assign_ip "router2" 1 "10.5.2.2/24"
|
||||
assign_ip "router2" 2 "10.5.3.4/24"
|
||||
assign_ip "router2" 3 "10.5.6.1/24"
|
||||
assign_ip "router2" 4 "10.5.5.5/24"
|
||||
|
||||
|
||||
echo "assigning IP on router3"
|
||||
|
||||
assign_ip "router3" 1 "10.5.3.2"
|
||||
assign_ip "router3" 2 "10.5.4.3"
|
||||
assign_ip "router3" 3 "10.5.4.4"
|
||||
assign_ip "router3" 4 "10.5.5.2"
|
||||
assign_ip "router3" 1 "10.5.3.2/24"
|
||||
assign_ip "router3" 2 "10.5.4.3/24"
|
||||
assign_ip "router3" 3 "10.5.6.2/24"
|
||||
assign_ip "router3" 4 "10.5.7.1/24"
|
||||
|
||||
echo "assigning IP on router4"
|
||||
|
||||
assign_ip "router4" 1 "10.5.2.4"
|
||||
assign_ip "router4" 2 "10.5.5.4"
|
||||
assign_ip "router4" 3 "10.5.5.3"
|
||||
assign_ip "router4" 1 "10.5.2.4/24"
|
||||
assign_ip "router4" 2 "10.5.5.4/24"
|
||||
assign_ip "router4" 3 "10.5.7.2/24"
|
||||
|
||||
echo "assigning IP on pc1"
|
||||
|
||||
assign_ip "pc1" 1 "10.5.1.1"
|
||||
assign_ip "pc1" 1 "10.5.1.1/24"
|
||||
|
||||
|
||||
echo "assigning IP on pc2"
|
||||
|
||||
assign_ip "pc2" 1 "10.5.2.1"
|
||||
assign_ip "pc2" 1 "10.5.2.1/24"
|
||||
|
||||
echo "assigning IP on pc3"
|
||||
echo "assigning IP on pc3"
|
||||
|
||||
assign_ip "pc3" 1 "10.5.3.1"
|
||||
assign_ip "pc3" 1 "10.5.3.1/24"
|
||||
bash ~/checkip.sh
|
||||
|
1
Blatt02/scripts/output/pc1_10.5.1.2_1
Normal file
1
Blatt02/scripts/output/pc1_10.5.1.2_1
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.2 (10.5.1.2) from 10.5.1.1 eth1: 56(84) bytes of data. 64 bytes from 10.5.1.2: icmp_seq=1 ttl=64 time=1.46 ms 64 bytes from 10.5.1.2: icmp_seq=2 ttl=64 time=0.903 ms 64 bytes from 10.5.1.2: icmp_seq=3 ttl=64 time=0.818 ms 64 bytes from 10.5.1.2: icmp_seq=4 ttl=64 time=0.681 ms 64 bytes from 10.5.1.2: icmp_seq=5 ttl=64 time=0.699 ms --- 10.5.1.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4012ms rtt min/avg/max/mdev = 0.681/0.911/1.458/0.284 ms
|
1
Blatt02/scripts/output/pc1_10.5.1.2_1.200
Normal file
1
Blatt02/scripts/output/pc1_10.5.1.2_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.2 (10.5.1.2) from 10.5.1.1 eth1.200: 56(84) bytes of data. 64 bytes from 10.5.1.2: icmp_seq=1 ttl=64 time=0.690 ms 64 bytes from 10.5.1.2: icmp_seq=2 ttl=64 time=0.762 ms 64 bytes from 10.5.1.2: icmp_seq=3 ttl=64 time=0.782 ms 64 bytes from 10.5.1.2: icmp_seq=4 ttl=64 time=0.785 ms 64 bytes from 10.5.1.2: icmp_seq=5 ttl=64 time=0.776 ms --- 10.5.1.2 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 0.690/0.759/0.785/0.035 ms
|
1
Blatt02/scripts/output/pc1_10.5.1.3_1.200
Normal file
1
Blatt02/scripts/output/pc1_10.5.1.3_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.3 (10.5.1.3) from 10.5.1.1 eth1.200: 56(84) bytes of data. --- 10.5.1.3 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4091ms pipe 3
|
1
Blatt02/scripts/output/pc1_10.5.1.4_1.200
Normal file
1
Blatt02/scripts/output/pc1_10.5.1.4_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.4 (10.5.1.4) from 10.5.1.1 eth1.200: 56(84) bytes of data. --- 10.5.1.4 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4092ms pipe 3
|
1
Blatt02/scripts/output/pc2_10.5.1.1_1
Normal file
1
Blatt02/scripts/output/pc2_10.5.1.1_1
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.1 (10.5.1.1) from 10.5.1.2 eth1: 56(84) bytes of data. 64 bytes from 10.5.1.1: icmp_seq=1 ttl=64 time=0.749 ms 64 bytes from 10.5.1.1: icmp_seq=2 ttl=64 time=0.649 ms 64 bytes from 10.5.1.1: icmp_seq=3 ttl=64 time=0.705 ms 64 bytes from 10.5.1.1: icmp_seq=4 ttl=64 time=0.739 ms 64 bytes from 10.5.1.1: icmp_seq=5 ttl=64 time=0.693 ms --- 10.5.1.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4101ms rtt min/avg/max/mdev = 0.649/0.707/0.749/0.035 ms
|
1
Blatt02/scripts/output/pc2_10.5.1.1_1.200
Normal file
1
Blatt02/scripts/output/pc2_10.5.1.1_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.1 (10.5.1.1) from 10.5.1.2 eth1.200: 56(84) bytes of data. 64 bytes from 10.5.1.1: icmp_seq=1 ttl=64 time=0.704 ms 64 bytes from 10.5.1.1: icmp_seq=2 ttl=64 time=0.709 ms 64 bytes from 10.5.1.1: icmp_seq=3 ttl=64 time=0.741 ms 64 bytes from 10.5.1.1: icmp_seq=4 ttl=64 time=0.775 ms 64 bytes from 10.5.1.1: icmp_seq=5 ttl=64 time=0.878 ms --- 10.5.1.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4065ms rtt min/avg/max/mdev = 0.704/0.761/0.878/0.063 ms
|
1
Blatt02/scripts/output/pc2_10.5.1.3_1.200
Normal file
1
Blatt02/scripts/output/pc2_10.5.1.3_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.3 (10.5.1.3) from 10.5.1.2 eth1.200: 56(84) bytes of data. --- 10.5.1.3 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4084ms pipe 3
|
1
Blatt02/scripts/output/pc2_10.5.1.4_1.200
Normal file
1
Blatt02/scripts/output/pc2_10.5.1.4_1.200
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.4 (10.5.1.4) from 10.5.1.2 eth1.200: 56(84) bytes of data. --- 10.5.1.4 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4078ms pipe 3
|
1
Blatt02/scripts/output/pc3_10.5.1.1_1.100
Normal file
1
Blatt02/scripts/output/pc3_10.5.1.1_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.1 (10.5.1.1) from 10.5.1.3 eth1.100: 56(84) bytes of data. --- 10.5.1.1 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4083ms pipe 3
|
1
Blatt02/scripts/output/pc3_10.5.1.2_1.100
Normal file
1
Blatt02/scripts/output/pc3_10.5.1.2_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.2 (10.5.1.2) from 10.5.1.3 eth1.100: 56(84) bytes of data. --- 10.5.1.2 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4087ms pipe 3
|
1
Blatt02/scripts/output/pc3_10.5.1.4_1.100
Normal file
1
Blatt02/scripts/output/pc3_10.5.1.4_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.4 (10.5.1.4) from 10.5.1.3 eth1.100: 56(84) bytes of data. 64 bytes from 10.5.1.4: icmp_seq=1 ttl=64 time=0.810 ms 64 bytes from 10.5.1.4: icmp_seq=2 ttl=64 time=0.608 ms 64 bytes from 10.5.1.4: icmp_seq=3 ttl=64 time=0.950 ms 64 bytes from 10.5.1.4: icmp_seq=4 ttl=64 time=0.863 ms 64 bytes from 10.5.1.4: icmp_seq=5 ttl=64 time=0.823 ms --- 10.5.1.4 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4036ms rtt min/avg/max/mdev = 0.608/0.810/0.950/0.112 ms
|
1
Blatt02/scripts/output/router4_10.5.1.1_1.100
Normal file
1
Blatt02/scripts/output/router4_10.5.1.1_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.1 (10.5.1.1) from 10.5.1.4 eth1.100: 56(84) bytes of data. --- 10.5.1.1 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4083ms pipe 3
|
1
Blatt02/scripts/output/router4_10.5.1.2_1.100
Normal file
1
Blatt02/scripts/output/router4_10.5.1.2_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.2 (10.5.1.2) from 10.5.1.4 eth1.100: 56(84) bytes of data. --- 10.5.1.2 ping statistics --- 5 packets transmitted, 0 received, 100% packet loss, time 4087ms pipe 3
|
1
Blatt02/scripts/output/router4_10.5.1.3_1.100
Normal file
1
Blatt02/scripts/output/router4_10.5.1.3_1.100
Normal file
@ -0,0 +1 @@
|
||||
PING 10.5.1.3 (10.5.1.3) from 10.5.1.4 eth1.100: 56(84) bytes of data. 64 bytes from 10.5.1.3: icmp_seq=1 ttl=64 time=0.632 ms 64 bytes from 10.5.1.3: icmp_seq=2 ttl=64 time=0.561 ms 64 bytes from 10.5.1.3: icmp_seq=3 ttl=64 time=0.538 ms 64 bytes from 10.5.1.3: icmp_seq=4 ttl=64 time=0.564 ms 64 bytes from 10.5.1.3: icmp_seq=5 ttl=64 time=0.565 ms --- 10.5.1.3 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4097ms rtt min/avg/max/mdev = 0.538/0.572/0.632/0.031 ms
|
48
Blatt02/scripts/test_ping.sh
Normal file
48
Blatt02/scripts/test_ping.sh
Normal file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
test_ping(){
|
||||
local sender_dev=$1
|
||||
local sender_eth=$2
|
||||
local receiver_dev=$3
|
||||
local receiver_eth=$4
|
||||
local receiver_ip=$5
|
||||
|
||||
loss=$(ssh $sender_dev "ping -c 5 -W 2 -I eth$sender_eth $receiver_ip | awk -F', ' '/packet loss/ {print \$3}' | awk '{print int(\$1)}'")
|
||||
echo $loss
|
||||
}
|
||||
|
||||
loss_count=0
|
||||
|
||||
localloss=$(test_ping "router1" 1 "pc1" 1 "10.5.1.1")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router1" 2 "router2" 2 "10.5.3.4")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router1" 3 "router3" 2 "10.5.4.3")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router1" 4 "router4" 1 "10.5.2.4")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
|
||||
localloss=$(test_ping "router2" 1 "pc2" 1 "10.5.2.1")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router2" 3 "router3" 3 "10.5.6.2")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router2" 4 "router4" 2 "10.5.5.4")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
|
||||
localloss=$(test_ping "router3" 1 "pc3" 1 "10.5.3.1")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
localloss=$(test_ping "router3" 4 "router4" 3 "10.5.7.2")
|
||||
loss_count=$(($loss_count+$localloss))
|
||||
echo $loss_count
|
||||
|
||||
echo $loss_count
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user