Skip to content

Instantly share code, notes, and snippets.

@ralvares
Last active October 7, 2022 13:20
Show Gist options
  • Save ralvares/7011968ef2e1f8cc1a9c410abff32653 to your computer and use it in GitHub Desktop.
Save ralvares/7011968ef2e1f8cc1a9c410abff32653 to your computer and use it in GitHub Desktop.
### libvirt lab network ###
cat > /root/lab.xml << EOF
<network connections='8'>
<name>lab</name>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<dns enable="no"/>
<bridge name='lab' stp='on' delay='0'/>
<mac address='52:54:00:c5:c4:37'/>
<ip address='192.168.150.1' netmask='255.255.255.0'>
</ip>
</network>
EOF
virsh net-define lab.xml
virst net-start lab
ip a show lab
#### Configuring dnsmasq ####
cat > /etc/dnsmasq.d/ocp.conf << EOF
listen-address=192.168.150.1
bind-interfaces
addn-hosts=/etc/hosts.dnsmasq
dhcp-range=192.168.150.50,192.168.150.150,1000000h
#SNO STATICIP
dhcp-host=56:6f:80:a6:00:25,192.168.150.10
address=/apps.ocp.ocp4.local/192.168.150.10
EOF
cat > /etc/hosts.dnsmasq << EOF
192.168.150.10 api-int.ocp.ocp4.local api.ocp.ocp4.local
EOF
systemctl restart dnsmasq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment