Prepare Hardware or Virtual Machine
Enable Nested Virtualizationhttps://pnetlab.com/pages/documentation?slug=install-bare-metal
Get Ubuntu 18.04 Cloud Image
Remove netplan & reboot
코드 블럭 |
---|
apt -y purge netplan.io
reboot |
Config network
https://pnetlab.com/pages/documentation?slug=fix-name-resolution-error
- /etc/network/interfaces
- /etc/resolv.conf
Add repo
코드 블럭 |
---|
title | /etc/apt/sources.list.d/pnetlab.list |
---|
|
deb [trusted=yes] http://repo.pnetlab.com ./ |
Install PNETLab
코드 블럭 |
---|
apt update
apt -y install pnetlab |
Install ishare2 Image Manager
https://github.com/ishare2-org/ishare2-cli
코드 블럭 |
---|
wget -O /usr/sbin/ishare2 https://raw.githubusercontent.com/ishare2-org/ishare2-cli/main/ishare2 && chmod +x /usr/sbin/ishare2 && ishare2 |
...
Install ishare2 Image Manager GUI
코드 블럭 |
---|
|
sed# -icd '/skip_ssl/d' /etc/mysql/mysql.conf.d/mysqld.cnf
echo "skip_ssl" >> /etc/mysql/mysql.conf.d/mysqld.cnf
sed -i 's/Update-Package-Lists "1"/Update-Package-Lists "0"/g' /etc/apt/apt.conf.d/20auto-upgrades |
Check network and configure
코드 블럭 |
---|
# brctl show
bridge name/opt
# git clone https://github.com/ishare2-org/ishare2-web-gui.git
# cd ishare2-web-gui
# docker images
REPOSITORY bridge id TAG IMAGE STP enabledID interfaces
docker0 CREATED 8000.024251d06cf7 no
pnet0SIZE
ishare 8000.566f4bf80108 latest no b8d5dcdcbe12 10 minutes ago eth0
pnet187.6MB
python 8000.566f4bf80109 3.11-alpine a6fe4140edea no 10 days ago 52.5MB |
Patch A
https://pnetlab.com/pages/documentation?slug=fix-bug-file-get-contents
코드 블럭 |
---|
sed -i eth1
pnet2 8000.566f4bf8010a no eth2
pnet3 8000.000000000000 no
pnet4 8000.000000000000 no
pnet5 8000.000000000000 no
pnet6 8000.000000000000 no
pnet7 8000.000000000000 no
pnet8 8000.000000000000 no
pnet9 8000.000000000000 no
pnet_nat 8000.000000000000 no |
코드 블럭 |
---|
title | /etc/network/interfaces |
---|
linenumbers | true |
---|
|
# The primary network interface
iface eth0 inet manual
auto pnet0
# For DHCP Network
# iface pnet0 inet dhcp
# bridge_ports eth0
# bridge_stp off
# For Static Network
iface pnet0 inet static
address 192.168.0.10/24
gateway 192.168.0.1
bridge_ports eth0
bridge_stp off
# Cloud devices
iface eth1 inet manual
auto pnet1
iface pnet1 inet manual
bridge_ports eth1
bridge_stp off
...
iface eth9 inet manual
auto pnet9
iface pnet9 inet manual
bridge_ports eth9
bridge_stp off |
Reboot
...
'/skip_ssl/d' /etc/mysql/mysql.conf.d/mysqld.cnf
echo "skip_ssl" >> /etc/mysql/mysql.conf.d/mysqld.cnf
sed -i 's/Update-Package-Lists "1"/Update-Package-Lists "0"/g' /etc/apt/apt.conf.d/20auto-upgrades |
Patch B
(optional) enable offline mode as default, add offline account
코드 블럭 |
---|
# mysql -u pnetlab -p pnetlab_db
Enter password: pnetlab
Welcome to the MySQL monitor. Commands end with ; or \g.
Server version: 5.7.42-0ubuntu0.18.04.1 (Ubuntu)
mysql> INSERT INTO `control` VALUES ('ctrl_default_mode','offline'),('ctrl_offline_mode','1'),('ctrl_online_mode','1');
mysql> INSERT INTO `users` VALUES (1,'admin',NULL,NULL,-1,NULL,'fcfcbba4e322bb69d53fe0f8a2b03d7f3c37ee3fb3d51864785c899aaeaaeb5d',NULL,NULL,'0',NULL,NULL,NULL,NULL,1723433636,NULL,1,NULL,NULL,1,NULL,NULL,NULL); |
Patch C
(optional) disable boot screen and show boot logs
코드 블럭 |
---|
sed -i 's/quiet splash //g' /etc/default/grub
sed -i 's/quiet splash //g' /boot/grub/grub.cfg |
Configure (reconfigure)
코드 블럭 |
---|
rm /opt/ovf/.configured
/bin/bash /opt/ovf/ovfconfig.sh |
Configure Network and NTP server using setup script
Image Added
Reboot
Firewall
(optional)
코드 블럭 |
---|
|
apt -y install ufw
systemctl enable --now ufw
ufw allow from 172.16.0.0/12 comment "Docker Internal"
ufw allow from 10.177.0.0/16 comment "Docker Internal"
ufw allow from 192.168.0.0/24 comment "MyNetwork"
ufw status numbered |
Reference
https://pnetlab.com/pages/documentation?slug=install-bare-metal