Commit 393dfa45 authored by Jan Moskyto Matejka's avatar Jan Moskyto Matejka

birdlab fices

parent 3fc80f57
......@@ -10,7 +10,7 @@ ip link add $VIRTCTRL type veth peer name $VIRTUPLINK
ip link set $VIRTCTRL up
ip link set $VIRTUPLINK up
ip addr add 192.168.192.1/18 dev $VIRTCTRL
ip -6 addr add 2001:1488:A001::/64 dev $VIRTCTRL
ip -6 addr add 2001:1488:A001::1/64 dev $VIRTCTRL
vsctl add-port $VIRTBR $VIRTUPLINK tag=1
......
......@@ -7,33 +7,39 @@ use IO::Socket::UNIX;
my $client = IO::Socket::UNIX->new( Type => SOCK_STREAM(), Peer => "/var/lib/virt/run/$ARGV[0].serial");
my $data;
my $debug = 0;
sub D { say @_ if $debug; }
sub S { say "\rmikrotik init ", @_; }
$/ = "";
my $state = "login";
say "init client";
say "";
S "started";
D "init client";
syswrite $client, "\r";
while (1) {
say "";
D "";
sleep 1;
sysread $client, $data, 65536;
$data =~ s/[^ -~]/?/g;
print Dumper \$data;
D Dumper \$data;
if ($data =~ /MikroTik Login: $/) {
say "sending login";
S "sending login";
syswrite $client, "root\r";
$state = "login";
next;
}
if ($data =~ /assword: $/) {
say "sending password";
S "sending password";
syswrite $client, "root\r";
next;
}
if ($data =~ /tinue!/) {
say "continue boilerplate";
S "continue boilerplate";
syswrite $client, "\r";
# $state = "export";
$state = "macreset";
......@@ -41,43 +47,46 @@ while (1) {
}
if ($data =~ /\[root\@MikroTik\] > $/ && $state eq "export") {
say "export";
D "export";
syswrite $client, "export\r";
$state = "macreset";
next;
}
if ($data =~ /\[root\@MikroTik\] > $/ && $state eq "macreset") {
say "interface ethernet reset-mac-address numbers=0";
D "interface ethernet reset-mac-address numbers=0";
S "reset mac address";
syswrite $client, "interface ethernet reset-mac-address numbers=0\r";
$state = "dhcp";
next;
}
if ($data =~ /\[root\@MikroTik\] > $/ && $state eq "dhcp") {
say "ip dhcp-client renew numbers=0";
D "ip dhcp-client renew numbers=0";
S "flush dhcp";
syswrite $client, "ip dhcp-client renew numbers=0\r";
$state = "quit";
next;
}
if ($data =~ /\[root\@MikroTik\] > $/ && $state eq "quit") {
say "quit";
D "quit";
syswrite $client, "quit\r";
sleep 1;
sysread $client, $data, 65536;
$data =~ s/[^ -~]/?/g;
print Dumper \$data;
D Dumper \$data;
S "done", " "x50;
exit 0;
}
if ($data =~ /\[root\@MikroTik\] > $/) {
say "Logged in, noop now";
D "Logged in, noop now";
syswrite $client, "\r";
$state = "macreset";
next;
}
say "NOP, strange input";
D "NOP, strange input";
}
......@@ -79,13 +79,14 @@ if [ -n "$HOSTNIC" ]; then
IFS=';' read NETNAME MAC TAG IP4 IP4PEER <<<"$N"
TAPID=$(mactotap $MAC)
HOSTNICDEV="$HOSTNICDEV -netdev tap,id=$TAPID,ifname=$TAPID,script=no -device e1000,netdev=$TAPID,mac=$MAC"
echo "N=\$(ifname \${IFBYMAC[$MAC]})" >>$RCGFILE
echo "N=\$(ifname \${IFBYMAC[$MAC]} $NETNAME)" >>$RCGFILE
echo "IFBYMAC[$MAC]=\$N" >>$RCGFILE
if [ -n "$IP4PEER"]; then
if [ -n "$IP4PEER" ]; then
echo "ip4ptp \$N $IP4 $IP4PEER" >>$RCGFILE
else
echo "ip4 \$N $IP4" >>$RCGFILE
fi
echo "ifup \$N" >>$RCGFILE
HOSTNICVLAN+=( $TAPID,$TAG )
done
......@@ -130,13 +131,14 @@ if [ -n "$HOSTSOCK" ]; then
IFS=';' read SOCKNAME APPEND MAC IP4 <<<"$S"
TAPID=$(mactotap $MAC)
HOSTNICDEV="$HOSTNICDEV -netdev socket,$APPEND,id=$SOCKNAME -device e1000,netdev=$SOCKNAME,mac=$MAC"
echo "N=\$(ifname \${IFBYMAC[$MAC]})" >>$RCGFILE
echo "N=\$(ifname \${IFBYMAC[$MAC]} $SOCKNAME)" >>$RCGFILE
echo "IFBYMAC[$MAC]=\$N" >>$RCGFILE
if [ -n "$IP4PEER"]; then
echo "ip4ptp \$N $IP4 $IP4PEER" >>$RCGFILE
else
echo "ip4 \$N $IP4" >>$RCGFILE
fi
echo "ifup \$N" >>$RCGFILE
done
fi
......
......@@ -16,6 +16,12 @@ Host freebsd10-install
VNC 51
Type freebsd
Host freebsd11-install
Image freebsd11
Memory 512M
VNC 51
Type freebsd
Host freebsd082
Image freebsd082
Memory 8G
......@@ -28,6 +34,12 @@ Host freebsd10
Type freebsd
Cow yes
Host freebsd11
Image freebsd11
Memory 512M
Type freebsd
Cow yes
Host netbsd70-install
Image netbsd70
Memory 512M
......@@ -64,6 +76,18 @@ Host debian5
Type linux
Cow yes
Host centos7-install
Image centos7
Memory 512M
VNC 13
Type linux
Host centos7
Image centos7
Memory 512M
Type linux
Cow yes
Host mikrotik-install
Image mikrotik
Memory 128M
......@@ -76,8 +100,21 @@ Host mikrotik
Cow yes
Type mikrotik
Host rpki-rtr
Image rpki-rtr
Memory 1024M
VNC 6
Type linux
Host netlink
Image debian8-netlink
Memory 2G
VNC 15
Type linux
Copy openbsd58 ob1 ob2 ob3
Copy freebsd10 fb1 fb2 fb3
Copy netbsd70 nb1 nb2 nb3
Copy debian8 d1 d2 d3 d4
Copy debian8 minidebian
......@@ -100,6 +137,10 @@ Copy minidebian mov
Host mov
VNC 5
Copy centos7 minicentos
Host minicentos
Memory 512M
#Copy minidebian md1111 md1112 md1121 md1122 md1211 md1212 md1221 md1222 md2111 md2112 md2121 md2122 md2211 md2212 md2221 md2222
Copy minidebian md1111 md1112
......@@ -155,19 +196,23 @@ Copy minifb atf1
#Copy mikrotik atm1
Copy mininb atn1
Copy miniob ato1
Copy minicentos atc1
Gre atd1f1 atd1 1.1.1.1/32 atf1 1.1.1.2/32
Gre atd1o1 atd1 1.1.1.3/32 ato1 1.1.1.4/32
Gre atd1n1 atd1 1.1.1.5/32 atn1 1.1.1.6/32
Gre atd1c1 atd1 1.1.1.7/32 atc1 1.1.1.8/32
Gre atd2f1 atd2 1.1.2.1/32 atf1 1.1.2.2/32
Gre atd2o1 atd2 1.1.2.3/32 ato1 1.1.2.4/32
Gre atd2n1 atd2 1.1.2.5/32 atn1 1.1.2.6/32
Gre atd2c1 atd2 1.1.2.7/32 atc1 1.1.2.8/32
Dummy atd1 atd1 10.55.1.1/24 fd01:55:1::1/64
Dummy ato1 ato1 10.55.2.1/24 fd01:55:2::1/64
Dummy atf1 atf1 10.55.3.1/24 fd01:55:3::1/64
Dummy atn1 atn1 10.55.4.1/24 fd01:55:4::1/64
Dummy atd2 atd2 10.55.5.1/24 fd01:55:5::1/64
Dummy atc1 atc1 10.55.6.1/24 fd01:55:6::1/64
Copy mikrotik mpls-auto mpls-e1 mpls-e2 mpls-p1 mpls-p2 mpls-p3 mpls-p4 mpls-c1 mpls-c2
......
......@@ -126,12 +126,14 @@ function dummy() {
netbsd)
LIF=lo$(locount)
ifconfig $LIF create
ifconfig $LIF inet6 fe80::1/64
echo $LIF
INTERFACES+=( $LIF, )
;;
openbsd)
LIF=lo$(locount)
ifconfig $LIF create
ifconfig $LIF inet6 fe80::1/64
ifconfig $LIF description $1
echo $LIF
INTERFACES+=( $LIF, )
......@@ -139,6 +141,7 @@ function dummy() {
freebsd)
LIF=lo$(locount)
ifconfig $LIF create
ifconfig $LIF inet6 fe80::1/64
ifconfig $LIF name $1
echo $1
INTERFACES+=( $1, )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment