mirror of https://github.com/pikvm/pikvm.git
3.4 KiB
3.4 KiB
Ethernet-over-USB network
Specifically to v2. When combined with configuring a DNS server, FTP, or SMB (for example), this is a powerful way to extend the capabilities of PiKVM.
❗ The USB-Ethernet features are experimental, so some of the default settings may be changed in future releases.
- Edit
/etc/kvmd/override.yaml(remove{}if this your first configuration entry) and add these lines:
Theotg: devices: ethernet: enabled: true driver: ecm host_mac: 48:6f:73:74:50:43 kvm_mac: 42:61:64:55:53:42host_macaddress will be used on the server's network interface. Thekvm_macmeans the address that will be assigned to the local interface on the PiKVM. The KVM interface will be calledusb0network interface. If thehost_macorkvm_macis not specified, a random value will be used. Thedriverparameter means the protocol that will be used for the USB network. The default value isecmso it can be passed it this example. Other possible values areeem,ncmandrndis. - To automatically configure the USB network on the server recommended using the service
kvmd-otgnet. It configures the firewall, assigns an address to the local PiKVM interfaceusb0and starts DHCP so the managed server can get the IPv4 address. By default, the address169.254.0.1/28to interfaceusb0will be assigned. One of the other addresses from the network169.254.0.0./28will be assigned to the server when it requests it via DHCP. For security reasons, all incoming connections from the server to the PiKVM side are blocked (except for ICMP and UDP port 67 which is used for DHCP). If you want to allow access from the server to the PiKVM interface, then you need to add ports 80 and 443 to the whitelist using/etc/kvmd/override.yamlfile like this:
To view other available configuration parameters, use the commandotgnet: firewall: allow_tcp: [80, 443]kvmd -m. - To enable the service, use the command
systemctl enable kvmd-otgnet. - Perform
reboot.
Routing via PiKVM
By default, kvmd-otgnet will configure network connection between PiKVM and the server host only. The server host will not be able to reach other hosts beyond PiKVM. If the full network access is required from the server host through the USB-Ethernet feature (access all hosts PiKVM can access), additional settings are needed in /etc/kvmd/override.yaml.
- Run
echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/99-kvmd-extra.conf. - Add network interface to forward requests to (default gateway) by adding a line
forward_iface: <interface name>underfirewall:. Typically it would beeth0if the built-in ethernet port is used::otgnet: firewall: forward_iface: eth0 - Add DNS server to provide host name resolution service. For example, adding
8.8.8.8as DNS server requires addition ofdnsmasqdhcp options. This can be done by adding following lines to/etc/kvmd/override.yaml:otgnet: commands: post_start_cmd_append: - "--dhcp-option=6,8.8.8.8" - Combining above two together::
otgnet: firewall: forward_iface: eth0 commands: post_start_cmd_append: - "--dhcp-option=6,8.8.8.8" - Don't forget
reboot.