-
Notifications
You must be signed in to change notification settings - Fork 0
環境準備
m.hagiwara edited this page Feb 12, 2018
·
4 revisions
- ubuntu-16.04.3-server-amd64.isoで
- basic system utils / open ssh serverをインストール
TODO: スクショを貼る
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install kvm virt-manager libvirt-bin bridge-utils
sudo visudo
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
sudo vi /etc/network/interfaces
auto mgmt-br
iface mgmt-br inet static
pre-up brctl addbr mgmt-br
address 172.16.0.1
netmask 255.255.255.0
bridge_stp off
sudo service networking restart
sudo iptables -A FORWARD -i mgmt-br -o enp0s3 -s 172.16.0.0/24 -j ACCEPT
sudo iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A POSTROUTING -o enp0s3 -s 172.16.0.0/24 -j MASQUERADE
sudo mkdir -p /var/kvm/images
sudo virt-install --name yoyodyne-nettester --ram 1024 --disk path=/var/kvm/images/yoyodyne-nettester.img,size=5 --vcpus 1 --os-type linux --network bridge=mgmt-br --graphics none --console pty,target_type=serial --location 'http://jp.archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/' --extra-args 'console=ttyS0,115200n8 serial'
- ip=172.16.0.2/24
- dnsはホストの環境(192.168.0.2)を指定。
- こちらもbasic system utils / open ssh serverをインストール
- かなり時間がかかるので信じて待つ
- OSだけで90分くらいかかる
handson@yoyodyne-nettester:~$ sudo vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="text"
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
handson@yoyodyne-nettester:~$ sudo update-grub
sudo visudo
sudo apt install curl git ruby2.3 ruby2.3-dev rubygems-integration build-essential rake openvswitch-switch ethtool iproute2 libxml2-dev zlib1g-dev ntp ntpdate libsqlite3-dev
sudo gem install bundle
curl -sS https://raw.githubusercontent.com/net-tester/net-tester/develop/script/install.sh
| sh
handson@yoyodyne-nettester:~$ sudo shutdown -h now
handson@scenario:/var/kvm/images$ sudo virsh list
Id Name State
----------------------------------------------------
handson@scenario:/var/kvm/images$ sudo virt-clone -o yoyodyne-nettester -n tajimax-nettester -f /var/kvm/images/tajimax-nettester.img
Allocating 'tajimax-nettester.img' | 5.0 GB 00:26
Clone 'tajimax-nettester' created successfully.
handson@scenario:/var/kvm/images$ sudo virsh start tajimax-nettester
Domain tajimax-nettester started
handson@scenario:/var/kvm/images$ ssh 172.16.0.2
handson@yoyodyne-nettester:~$ sudo vi /etc/network/interfaces
iface ens2 inet static
address 172.16.0.3
handson@yoyodyne-nettester:~$ sudo vi /etc/hostname
tajimax-nettester
handson@tajimax-nettester:~$ sudo vi /etc/hosts
172.16.0.3 tajimax-nettester
handson@yoyodyne-nettester:~$ sudo reboot
handson@scenario:/var/kvm/images$ ssh 172.16.0.3
[email protected]'s password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-104-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Last login: Wed Dec 20 15:51:30 2017 from 172.16.0.1
handson@tajimax-nettester:~$ sudo shutdown -h now
Connection to 172.16.0.3 closed by remote host.
Connection to 172.16.0.3 closed.
sudo apt-get install curl git ruby2.3 ruby2.3-dev rubygems build-essential rake rubygems-integration
sudo gem install bundle
git clone https://github.com/net-tester/multisite-examples.git
cd multisite-examples
git config --global url."https://".insteadOf "git://"
bundle install --path=vendor/bundle
handson@scenario:/var/kvm/images$ sudo wget "http://packages.vyos.net/iso/release/1.1.8/vyos-1.1.8-amd64.iso"
sudo virt-install --name yoyodyne-vyos --ram 512 --disk path=/var/kvm/images/yoyodyne-vyos.img,size=2 --vcpus 1 --os-type linux --network bridge=mgmt-br --graphics none --cdrom /var/kvm/images/vyos-1.1.8-amd64.iso --os-variant=debiansqueeze
そのままのbootではpromptが来なかった。
F3(c-F 3) でboot menuを確認し live-console でbootする
install system
- 今回は使い捨てなのでsystemで。オプションをいくつか聞かれるがすべてデフォルトで
vyos@vyos# set interfaces ethernet eth0 address 172.16.0.4/24
[edit]
vyos@vyos# set service ssh port '22'
[edit]
vyos@vyos# commit
[ service ssh ]
Restarting OpenBSD Secure Shell server: sshd.
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
一旦止める
vyos@vyos:~$ poweroff
Proceed with poweroff? (Yes/No) [No] yes
handson@scenario:~$ sudo virt-clone -o yoyodyne-vyos -n global-vyos -f /var/kvm/images/global-vyos.img
Allocating 'global-vyos.img' | 2.0 GB 00:08
Clone 'global-vyos' created successfully.
handson@scenario:~$ sudo virsh start global-vyos
Domain global-vyos started
handson@scenario:~$ sudo virsh console global-vyos
vyos@vyos:~$ conf
set [edit]
vyos@vyos# set system host-name global-vyos
[edit]
vyos@vyos# commit
[ system host-name global-vyos ]
Stopping enhanced syslogd: rsyslogd.
Starting enhanced syslogd: rsyslogd.
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos# set interfaces ethernet eth1 address 172.16.0.5/24
[edit]
vyos@vyos# commit
[edit]
vyos@vyos# save
Saving configuration to '/config/config.boot'...
Done
[edit]
vyos@vyos# exit
exit
vyos@vyos:~$ poweroff
Proceed with poweroff? (Yes/No) [No] yes
handson@scenario:~$ sudo vi /etc/rc.local
for i in internal dmz internet ; do
/sbin/ip l add name nt_${i} type veth peer name vyos_${i}
/sbin/ip l set up dev nt_${i}
/sbin/ip l set up dev vyos_${i}
/sbin/ip l set promisc on dev nt_${i}
/sbin/ip l set promisc on dev vyos_${i}
done
/sbin/ip l add name yo_global type veth peer name ta_global
/sbin/ip l set up dev yo_global
/sbin/ip l set up dev ta_global
/sbin/ip l set promisc on dev yo_global
/sbin/ip l set promisc on dev ta_global
handson@scenario:~$ sudo bash /etc/rc.local