This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
docpublic:systemes:linux:virt_kvm [2016/12/18 12:10] procacci@tem-tsp.eu [VM pfsense] |
docpublic:systemes:linux:virt_kvm [2017/02/22 18:21] (current) procacci@tem-tsp.eu [add 2nd network on specific NIC] |
||
|---|---|---|---|
| Line 71: | Line 71: | ||
| </ | </ | ||
| + | |||
| + | ===== network ===== | ||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * http:// | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# virsh net-dumpxml default | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <forward mode=' | ||
| + | <nat> | ||
| + | <port start=' | ||
| + | </ | ||
| + | </ | ||
| + | <bridge name=' | ||
| + | <mac address=' | ||
| + | <ip address=' | ||
| + | < | ||
| + | <range start=' | ||
| + | </ | ||
| + | </ip> | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | locatio of xml file | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# ls / | ||
| + | autostart | ||
| + | </ | ||
| + | |||
| + | ==== dnsmasq ==== | ||
| + | |||
| + | lancé automatiquement par libvirt pour assurer la passralle DNS/ | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# cat / | ||
| + | ## | ||
| + | ## | ||
| + | ## virsh net-edit default | ||
| + | ## or other application using the libvirt API. | ||
| + | ## | ||
| + | ## dnsmasq conf file created by libvirt | ||
| + | strict-order | ||
| + | pid-file=/ | ||
| + | except-interface=lo | ||
| + | bind-dynamic | ||
| + | interface=virbr0 | ||
| + | dhcp-range=192.168.122.2, | ||
| + | dhcp-no-override | ||
| + | dhcp-lease-max=253 | ||
| + | dhcp-hostsfile=/ | ||
| + | addn-hosts=/ | ||
| + | [root@localhost ~]# cat / | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== add 2nd network on specific NIC ==== | ||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | definition manuelle du nouveau reseau | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# cat / | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | |||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# virsh net-define p4p1-net.xml | ||
| + | Réseau p4p1_routed défini depuis p4p1-net.xml | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# virsh net-start p4p1_routed | ||
| + | Réseau p4p1_routed démarré | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# virsh net-autostart p4p1_routed | ||
| + | Réseau p4p1_routed marqué en démarrage automatique | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# ls / | ||
| + | autostart | ||
| + | [root@localhost ~]# cat / | ||
| + | <!-- | ||
| + | WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE | ||
| + | OVERWRITTEN AND LOST. Changes to this xml configuration should be made using: | ||
| + | virsh net-edit p4p1_routed | ||
| + | or other application using the libvirt API. | ||
| + | --> | ||
| + | |||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <forward dev=' | ||
| + | < | ||
| + | </ | ||
| + | <bridge name=' | ||
| + | <mac address=' | ||
| + | <ip address=' | ||
| + | < | ||
| + | <range start=' | ||
| + | </ | ||
| + | </ip> | ||
| + | </ | ||
| + | [root@localhost ~]# | ||
| + | </ | ||
| + | |||
| + | ==== retrait reseau ==== | ||
| + | |||
| + | < | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# virsh net-destroy p4p1_routed | ||
| + | Réseau p4p1_routed détruit | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# virsh net-undefine p4p1_routed | ||
| + | Le réseau p4p1_routed n'est plus défini | ||
| + | |||
| + | [root@localhost ~]# virsh net-list --all | ||
| + | | ||
| + | ---------------------------------------------------------- | ||
| + | | ||
| + | |||
| + | [root@localhost ~]# ls / | ||
| + | autostart | ||
| + | </ | ||
| + | |||
| + | ==== ajout 2eme interface ===== | ||
| + | |||
| + | < | ||
| + | [root@localhost ~]# brctl show | ||
| + | bridge name bridge id STP enabled interfaces | ||
| + | virbr0 8000.5254005d4f0b yes virbr0-nic | ||
| + | vnet0 | ||
| + | virbr1 8000.525400f6a6f4 yes virbr1-nic | ||
| + | [root@localhost ~]# virsh attach-interface --domain pfsense --type bridge --source virbr1 --target eth2 --model virtioInterface attached successfully | ||
| + | |||
| + | [root@localhost ~]# virsh domiflist pfsense | ||
| + | Interface | ||
| + | ------------------------------------------------------- | ||
| + | vnet0 bridge | ||
| + | eth2 | ||
| + | |||
| + | </ | ||
| + | |||