Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use bridged network? #85

Closed
ghost opened this issue Feb 17, 2018 · 1 comment
Closed

How to use bridged network? #85

ghost opened this issue Feb 17, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 17, 2018

Hello,

My virtual machines can access the network, but they cannot be accessed from other machines. My understanding is that it is necessary to create the virtual machines as part of a bridged network. I can't see anything in the documentation or examples of how to do this.

When I create a vm it creates it on the default network which is 192.168.122.0/24 nat routed.

What do I need to do to create vms on the bridged network?

thanks!

(venv2.7) ubuntu@kvmhost:/opt/bootrinoserver$ kcli list -n
Using local hypervisor as no client was specified...
Listing Networks...
+---------+---------+------------------+------+---------+------+
| Network |   Type  |       Cidr       | Dhcp |  Domain | Mode |
+---------+---------+------------------+------+---------+------+
| default |  routed | 192.168.122.0/24 | True | default | nat  |
| enp3s0  | bridged |  192.168.1.0/24  | N/A  |   N/A   | N/A  |
+---------+---------+------------------+------+---------+------+
(venv2.7) ubuntu@kvmhost:/opt/bootrinoserver$

my network config looks like this:

(venv2.7) ubuntu@kvmhost:/opt/foo$ ifconfig -a
br0       Link encap:Ethernet  HWaddr d2:d6:16:58:19:e0
          inet addr:192.168.1.139  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::d0d6:16ff:fe58:19e0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1793715 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1069639 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1045650082 (1.0 GB)  TX bytes:160601041 (160.6 MB)

enp3s0    Link encap:Ethernet  HWaddr fc:aa:14:a9:95:bf
          inet addr:192.168.1.140  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1893677 errors:0 dropped:698 overruns:0 frame:0
          TX packets:1096978 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1126484261 (1.1 GB)  TX bytes:162790016 (162.7 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:7284 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7284 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:1619559 (1.6 MB)  TX bytes:1619559 (1.6 MB)

virbr0    Link encap:Ethernet  HWaddr 52:54:00:e3:e6:93
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:187 errors:0 dropped:0 overruns:0 frame:0
          TX packets:182 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12891 (12.8 KB)  TX bytes:18134 (18.1 KB)

virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:e3:e6:93
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vnet0     Link encap:Ethernet  HWaddr fe:54:00:06:ec:c1
          inet6 addr: fe80::fc54:ff:fe06:ecc1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:69 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1564 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5761 (5.7 KB)  TX bytes:84936 (84.9 KB)

wlp2s0    Link encap:Ethernet  HWaddr d0:7e:35:69:cf:b2
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

(venv2.7) ubuntu@kvmhost:/opt/foo$
@ghost ghost changed the title How to use networks? How to use bridged network? Feb 17, 2018
@karmab
Copy link
Owner

karmab commented Feb 17, 2018

hello,
when you dont specify a network, kcli defaults to default but you can specify your own settings.

so you can either define a profile or a plan and create a file for them.

  • profiles are used for creating vms with similar settings
  • plans are used to create several vms at once ( and additional objects like networks, containers,...)

in both cases, a basic yaml could look like this ( note how i indicate your bridged network, but it works the same for any nat network you have or create with kcli network of within a plan)

centos:
 template: CentOS-7-x86_64-GenericCloud.qcow2
 numcpus: 2
 disks:
  - size: 10
 nets:
  - name: enp3s0

put this in ~/.kcli/profiles.yml and you can then define vms with

kcli vm -p centos your_vm

or you can save this file anywhere and use this as a plan with

kcli plan -f your_file.yml

( the vm would be called centos in this case, but you can adjust the name in the file or run

kcli plan -f your_file.yml -P name=your_vm

to be complete, you can also treat this file as a profile (since the syntax for profiles and plans is similar), so you can run

kcli vm -p your_file.xml your_vm

@karmab karmab closed this as completed Feb 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant