Co-authored-by: Maxim Devaev <mdevaev@gmail.com>
6.7 KiB
Ethernet-over-USB network
Basic configuration
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.
-
Edit
/etc/kvmd/override.yaml
and add these lines:otg: devices: ethernet: enabled: true driver: ecm host_mac: 48:6f:73:74:50:43 kvm_mac: 42:61:64:55:53:42
The
host_mac
address will be used on the server's network interface. Thekvm_mac
means the address that will be assigned to the local interface on the PiKVM. The KVM interface will be calledusb0
network interface. If thehost_mac
orkvm_mac
is not specified, a random value will be used. Thedriver
parameter means the protocol that will be used for the USB network. The default value isecm
so it can be passed it this example. Other possible values areeem
,ncm
,rndis
andrndis5
.Driver compatibility:
Driver Operating System ecm Linux eem Linux rndis5 Windows XP to Windows 71
Linux > 2.6.13rndis Windows 7 and later2
Linux > 2.6.13ncm Windows 10 and later
Linux > 2.6.371: Manual driver installation is required. Download RNDIS 5 Windows
2: Automatic driver installation since kvmd-3.53 -
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 interfaceusb0
and starts DHCP so the managed server can get the IPv4 address. By default, the address169.254.0.1/28
to interfaceusb0
will be assigned. One of the other addresses from the network169.254.0.0./28
will 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.yaml
file like this:otgnet: firewall: allow_tcp: [80, 443]
To view other available configuration parameters, use the command
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 beeth0
if 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.8
as DNS server requires addition ofdnsmasq
dhcp 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 to
reboot
.
=======
??? example "An example of what the config would look like if you wanted the target to have inet access (Please edit to suit your needs):"
otgnet: firewall: allow_tcp: [80, 443] forward_iface: wlan0 commands: post_start_cmd_append: - "--dhcp-option=6,1.1.1.1,1.0.0.1" iface: ip_cmd: - /usr/bin/ip net: 10.65.0.0/28
=======
Working with Windows Computers
This has been proven to work with Windows:
- Set the driver type to
rndis
(see above) - Download this driver on the Windows machine and unzip it somewhere: [https://modclouddownloadprod.blob.core.windows.net/shared/mod-rndis-driver-windows.zip]
- Open the devices manager
- Select
Properties
of theComposite KVM Device
- Select the
RNDIS Device
and click properties
- Switch to the "Driver" Tab and then click "Update driver"
- Click "Browse my computer for driver software"
- Click "Let me pick from a list of available drivers on my Computer"
- From the list of available hardware types, scroll down and select "Network adapters", then click next
- Click "Have disk"
- Click Browse, navigate to the folder where you've stored the driver and select the
RNDIS.inf
, press Open and then OK
- Select "Acer Netchip RNDIS/Ethernet Gadget" and click Next
- Dismiss the warning about non-compatible drivers by clicking "Yes"
- You're done - the device should now be recognized.
- Verify the card is working by pinging your piKVM in a console:
ping 169.254.0.1