mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-23 04:10:25 +00:00
Use DHCP for VM networking (#54)
* Add python pip to buildroot * Use DHCP for agent * Use systemd for naming network interfaces * Removed eth0 dhcp setting * Add ETH_IFACE variable * Added explanation for ETH_IFACE name * Further explain ETH_IFACE value
This commit is contained in:
committed by
GitHub
parent
cca75fc5cc
commit
c25cfec84c
@@ -1,6 +0,0 @@
|
||||
[Match]
|
||||
OriginalName=*
|
||||
|
||||
[Link]
|
||||
NamePolicy=kernel
|
||||
MACAddressPolicy=persistent
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The variable ETH_IFACE contains the name the systemd gave to the network interface.
|
||||
# The systemd configures the name based on the QEMU parameters.
|
||||
# The parts of the name enp0s2 mean:
|
||||
# et - ethernet card. It means this is the ethernet interface.
|
||||
# p - means that the interface is connected to a PCI bus.
|
||||
# 0 - the interface is connected to bus 0.
|
||||
# s2 -the interface is connected to slot 2.
|
||||
|
||||
# The variable ETH_IFACE value must match the name configured through QEMU parameters for the network device.
|
||||
# The bus number and slot number are configured through QEMU device parameters, parameters
|
||||
# addr (for slot number), and bus (for bus number).
|
||||
ETH_IFACE=enp0s2
|
||||
|
||||
ip link set dev $ETH_IFACE up
|
||||
dhclient $ETH_IFACE
|
||||
AGENT_GRPC_HOST=$(ip -4 addr show $ETH_IFACE | grep inet | awk '{print $2}' | cut -d/ -f1)
|
||||
|
||||
export AGENT_GRPC_HOST
|
||||
|
||||
exec /bin/cocos-agent
|
||||
@@ -6,11 +6,10 @@ After=network.target
|
||||
StandardOutput=file:/var/log/cocos/agent.stdout
|
||||
StandardError=file:/var/log/cocos/agent.stderr
|
||||
|
||||
Environment=AGENT_GRPC_HOST=10.0.0.1
|
||||
Environment=AGENT_GRPC_PORT=7002
|
||||
Environment=AGENT_LOG_LEVEL=info
|
||||
|
||||
ExecStart=/bin/cocos-agent
|
||||
ExecStart=/cocos/agent_start_script.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
[Network]
|
||||
Address=10.0.0.1/24
|
||||
Reference in New Issue
Block a user