(Redirected from Network Configuration)
- Then you may want to reset your network settings to fix these problems. See also: macOS: “WiFi: No Hardware Installed Error”, Fix. Fortunately, you can reset your network settings easily on iOS devices. For example, if you own an iPad or iPhone, you can go to Settings General Reset and then Reset Network Settings.
- T he 'Use:' drop down should automatically select the correct drivers for your printer model. If it defaults to 'Generic Printer', try: Try changing the Protocol setting, and re-select 'Auto Select' from the Use menu. Repeat for each Protocol setting. Make sure you and your printer are powered on and connected to the network, naturally.
Network Configuration Manager is a multi-vendor network change, configuration and compliance management (NCCM) solution for switches, routers, firewalls and other network devices. NCM helps automate and take total control of the entire life cycle of device configuration.
This article describes how to configure network connections on OSI layer 3 and above. Medium-specifics are handled in the /Ethernet and /Wireless subpages.
- 1Check the connection
- 2Network management
- 2.3Network interfaces
- 2.7DHCP
- 3Set the hostname
- 4Tips and tricks
- 4.5IP address aliasing
- 5Troubleshooting
- 5.1The TCP window scaling problem
- 5.1.2Ways of fixing it
- 5.1The TCP window scaling problem
Check the connection
To troubleshoot a network connection, go through the following conditions and ensure that you meet them:
- Your network interface is listed and enabled. Otherwise, check the device driver – see /Ethernet#Device driver or /Wireless#Device driver.
- You are connected to the network. The cable is plugged in or you are connected to the wireless LAN.
- Your network interface has an IP address.
- Your routing table is correctly set up.
- You can ping a local IP address (e.g. your default gateway).
- You can ping a public IP address (e.g.
8.8.8.8
, which is a Google DNS server and is a convenient address to test with). - Check if you can resolve domain names (e.g.
archlinux.org
).
Ping
This article or section needs expansion.
Reason: Add or link explanation of common ping errors like Unknown hosts / Network is unreachable. (Discuss in Talk:Network configuration#)
ping is used to test if you can reach a host.
For every reply you receive, the ping utility will print a line like the above. For more information see the ping(8) manual. Note that computers can be configured not to respond to ICMP echo requests. [1]
If you receive no reply, this may be related to your default gateway or your Internet Service Provider (ISP). You can run a traceroute to further diagnose the route to the host.
Note: If you receive an error like
ping: icmp open socket: Operation not permitted
when executing ping, try to re-install the iputils package.Network management
To set up a network connection, go through the following steps:
- Ensure your network interface is listed and enabled.
- Connect to the network. Plug in the Ethernet cable or connect to the wireless LAN.
- Configure your network connection:
- dynamic IP address: use DHCP
Note: The installation image uses systemd-resolved and systemd-networkd, which is configured as a DHCP client for wired and wireless network interfaces.
net-tools
Arch Linux has deprecated net-tools in favor of iproute2.[2]
Deprecated command | Replacement commands |
---|---|
arp | ip neighbor |
ifconfig | ip address, ip link |
netstat | ss |
route | ip route |
For a more complete rundown, see this blog post.
iproute2
iproute2 is a dependency of the basemeta package and provides the ip(8) command-line interface, used to manage network interfaces, IP addresses and the routing table. Be aware that configuration made using
ip
will be lost after a reboot. For persistent configuration, you can use a network manager or automate ip commands using scripts and systemd units. Also note that ip
commands can generally be abbreviated, for clarity they are however spelled out in this article.Network interfaces
By default udev assigns names to your network interfaces using Predictable Network Interface Names, which prefixes interfaces names with
en
(wired/Ethernet), wl
(wireless/WLAN), or ww
(WWAN).Tip: To change interface names, see #Change interface name and #Revert to traditional interface names.
Listing network interfaces
Both wired and wireless interface names can be found via
ls /sys/class/net
or ip link
. Note that lo
is the loop device and not used in making network connections.Wireless device names can also be retrieved using
iw dev
. See also /Wireless#Get the name of the interface.If your network interface is not listed, make sure your device driver was loaded successfully. See /Ethernet#Device driver or /Wireless#Device driver.
Enabling and disabling network interfaces
Network interfaces can be enabled or disabled using
ip link set interface up|down
, see ip-link(8).To check the status of the interface
eth0
:The
UP
in <BROADCAST,MULTICAST,UP,LOWER_UP>
is what indicates the interface is up, not the later state DOWN
.Note: If your default route is through interface
eth0
, taking it down will also remove the route, and bringing it back up will not automatically re-establish the default route. See #Routing table for re-establishing it.Static IP address
A static IP address can be configured with most standard network managers and also dhcpcd.
To manually configure a static IP address, add an IP address as described in #IP addresses, set up your routing table and configure your DNS servers.
IP addresses
IP addresses are managed using ip-address(8).
List IP addresses:
Add an IP address to an interface:
- Note that:
- the address is given in CIDR notation to also supply a subnet mask
+
is a special symbol that makesip
derive the broadcast address from the IP address and the subnet mask
Note: Make sure manually assigned IP addresses do not conflict with DHCP assigned ones.
Delete an IP address from an interface:
Delete all addresses matching a criteria, e.g. of a specific interface:
Tip: IP addresses can be calculated with ipcalc (ipcalc).
Routing table
The routing table is used to determine if you can reach an IP address directly or what gateway (router) you should use. If no other route matches the IP address, the default gateway is used.
The routing table is managed using ip-route(8).
PREFIX is either a CIDR notation or
default
for the default gateway.List IPv4 routes:
List IPv6 routes:
Add a route:
Delete a route:
DHCP
A Dynamic Host Configuration Protocol (DHCP) server provides clients with a dynamic IP address, the subnet mask, the default gateway IP address and optionally also with DNS name servers.
To use DHCP you need a DHCP server in your network and a DHCP client:
Client | Package | Archiso | Note | Systemd units |
---|---|---|---|---|
dhcpcd | dhcpcd | Yes | DHCP, DHCPv6, ZeroConf, static IP | dhcpcd.service , dhcpcd@interface.service |
ISC dhclient | dhclient | Yes | DHCP, DHCPv6, BOOTP, static IP | dhclient@interface.service |
- You should not run two DHCP clients simultaneously.
- Instead of directly using a standalone DHCP client you can also use a network manager, some of which have a built-in DHCP client.
- Alternatively, iwd has a built-in DHCP client that can be used with some configuration: iwd#Enable built-in network configuration.
- You can check if a DHCP server is running with dhcping.
- While waiting for an IP to be assigned you can run something like
watch -n 1 ping -c 1 archlinux.org
.
Servers
This article or section needs expansion.
Reason:systemd-networkd has DHCP server support. (Discuss in Talk:Network configuration#)
Server | Package | IPv4 | IPv6 | GUI | Interfaces | Storage backend(s) | Note |
---|---|---|---|---|---|---|---|
dhcpd | dhcp | Yes | Yes | Glass-ISC-DHCP | ? | File | |
dnsmasq | dnsmasq | Yes | Yes | No | ? | File | Also DNS, PXE and TFTP |
Kea | kea | Yes | Yes | Kea-Anterius (Experimental) | REST, RADIUS and NETCONF | File, MySQL, PostgreSQL and Cassandra | Also DNS |
Network managers
A network manager lets you manage network connection settings in so called network profiles to facilitate switching networks.
Note: There are many solutions to choose from, but remember that all of them are mutually exclusive; you should not run two daemons simultaneously.
Network manager | GUI | CLI tools | PPP support (e.g. 3G modem) | DHCP client | Systemd units | |
---|---|---|---|---|---|---|
ConnMan | 8 unofficial | No | connmanctl(1) | Yes (with ofonoAUR) | internal | connman.service |
netctl | 2 unofficial | No | netctl(1), wifi-menu | Yes | dhcpcd or dhclient | netctl-ifplugd@interface.service , netctl-auto@interface.service |
NetworkManager | Yes | No | nmcli(1), nmtui(1) | Yes | internal or dhclient | NetworkManager.service |
systemd-networkd | No | Yes (base) | networkctl(1) | No | internal | systemd-networkd.service , systemd-resolved.service |
Wicd | Yes | No | wicd-cli(8), wicd-curses(8) | No | dhcpcd or dhclient | wicd.service |
Set the hostname
A hostname is a unique name created to identify a machine on a network, configured in
/etc/hostname
—see hostname(5) and hostname(7) for details. The file can contain the system's domain name, if any. To set the hostname, edit/etc/hostname
to include a single line with myhostname
:Tip: For advice on choosing a hostname, see RFC 1178.
Alternatively, using hostnamectl(1):
To temporarily set the hostname (until reboot), use hostname(1) from inetutils:
To set the 'pretty' hostname and other machine metadata, see machine-info(5).
Local hostname resolution
This article or section needs expansion.
Reason: Explain why you want a resolvable hostname, why
127.0.1.1
is used (and why a static IP address should be preferred over it). (Discuss in Talk:Network configuration#)The
myhostname
Name Service Switch (NSS) module of systemd provides local hostname resolution without having to edit /etc/hosts
(hosts(5)). It is enabled by default.Some clients may however still rely on
/etc/hosts
, see [4][5] for examples.To configure the hosts file, add the following lines to
/etc/hosts
:Note: The order of hostnames/aliases that follow the IP address in
/etc/hosts
is significant. The first string is considered the canonical hostname and may be appended with parent domains, where domain components are separated by a dot (ie. .localdomain
above). All following strings on the same line are considered aliases. See hosts(5) for more info.As a result the system resolves to both entries:
For a system with a permanent IP address, that permanent IP address should be used instead of
127.0.1.1
.Local network hostname resolution
To make your machine accessible in your LAN via its hostname you can:
- edit the
/etc/hosts
file for every device in your LAN, see hosts(5) - set up a DNS server to resolve your hostname and make the LAN devices use it (e.g. via #DHCP)
- or the easy way: use a Zero-configuration networking service:
- Hostname resolution via Microsoft's NetBIOS. Provided by Samba on Linux. It only requires the
nmb.service
. Computers running Windows, macOS, or Linux withnmb
running, will be able to find your machine. - Hostname resolution via mDNS. Provided by either
nss_mdns
with Avahi (see Avahi#Hostname resolution for setup details) or systemd-resolved. Computers running macOS, or Linux with Avahi or systemd-resolved running, will be able to find your machine. The older Win32 API does not support mDNS, which may prevent some older Windows applications from accessing your device.
- Hostname resolution via Microsoft's NetBIOS. Provided by Samba on Linux. It only requires the
![Network configuration for mac catalina Network configuration for mac catalina](/uploads/1/1/2/2/112297415/274023082.jpg)
Tips and tricks
Change interface name
Note: When changing the naming scheme, do not forget to update all network-related configuration files and custom systemd unit files to reflect the change.
You can change the device name by defining the name manually with an udev-rule. For example:
These rules will be applied automatically at boot.
A couple of things to note:
- To get the MAC address of each card, use this command:
cat /sys/class/net/device_name/address
- Make sure to use the lower-case hex values in your udev rules. It does not like upper-case.
If the network card has a dynamic MAC, you can use
DEVPATH
, for example:To get the
DEVPATH
of all currently-connected devices, see where the symlinks in /sys/class/net/
lead. For example:The device path should match both the new and old device name, since the rule may be executed more than once on bootup. For example, in the second rule,
'/devices/pci*/*1c.0/*/net/enp*'
would be wrong since it will stop matching once the name is changed to en
. Only the system-default rule will fire the second time around, causing the name to be changed back to e.g. enp1s0
.If you are using a USB network device (e.g. Android phone tethering) that has a dynamic MAC address and you want to be able to use different USB ports, you could use a rule that matched depending on vendor and product ID instead:
To test your rules, they can be triggered directly from userspace, e.g. with
udevadm --debug test /sys/class/net/*
. Remember to first take down the interface you are trying to rename (e.g. ip link set enp1s0 down
).Note: When choosing the static names it should be avoided to use names in the format of 'ethX' and 'wlanX', because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g.:
net0
, net1
, wifi0
, wifi1
. For further details please see the systemd documentation.Revert to traditional interface names
If you would prefer to retain traditional interface names such as eth0, Predictable Network Interface Names can be disabled by masking the udev rule:
Alternatively, add
net.ifnames=0
to the kernel parameters.Set device MTU and queue length
You can change the device MTU and queue length by defining manually with an udev-rule. For example:
Note:mtu
: For PPPoE, the MTU should be no larger than 1492. You can also set MTU via systemd.netdev(5).tx_queue_len
: Small value for slower devices with a high latency like modem links and ISDN. High value is recommend for server connected over the high-speed Internet connections that perform large data transfers.
Bonding or LAG
See netctl or systemd-networkd, or Wireless bonding.
IP address aliasing
IP aliasing is the process of adding more than one IP address to a network interface. With this, one node on a network can have multiple connections to a network, each serving a different purpose. Typical uses are virtual hosting of Web and FTP servers, or reorganizing servers without having to update any other machines (this is especially useful for nameservers).
Example
To manually set an alias, for some NIC, use iproute2 to execute
To remove a given alias execute
Packets destined for a subnet will use the primary alias by default. If the destination IP is within a subnet of a secondary alias, then the source IP is set respectively. Consider the case where there is more than one NIC, the default routes can be listed with
ip route
.Promiscuous mode
Toggling promiscuous mode will make a (wireless) NIC forward all traffic it receives to the OS for further processing. This is opposite to 'normal mode' where a NIC will drop frames it is not intended to receive. It is most often used for advanced network troubleshooting and packet sniffing.
If you want to enable promiscuous mode on interface
eth0
run enable[email protected]
.Investigate sockets
ss is a utility to investigate network ports and is part of the iproute2 package. It has a similar functionality to the deprecated netstat utility.
Common usage includes:
Display all TCP Sockets with service names:
Display all TCP Sockets with port numbers:
Display all UDP Sockets:
For more information see ss(8).
Troubleshooting
The TCP window scaling problem
TCP packets contain a 'window' value in their headers indicating how much data the other host may send in return. This value is represented with only 16 bits, hence the window size is at most 64Kb. TCP packets are cached for a while (they have to be reordered), and as memory is (or used to be) limited, one host could easily run out of it.
Back in 1992, as more and more memory became available, RFC 1323 was written to improve the situation: Window Scaling. The 'window' value, provided in all packets, will be modified by a Scale Factor defined once, at the very beginning of the connection. That 8-bit Scale Factor allows the Window to be up to 32 times higher than the initial 64Kb.
It appears that some broken routers and firewalls on the Internet are rewriting the Scale Factor to 0 which causes misunderstandings between hosts. The Linux kernel 2.6.17 introduced a new calculation scheme generating higher Scale Factors, virtually making the aftermaths of the broken routers and firewalls more visible.
The resulting connection is at best very slow or broken.
How to diagnose the problem
First of all, let us make it clear: this problem is odd. In some cases, you will not be able to use TCP connections (HTTP, FTP, ...) at all and in others, you will be able to communicate with some hosts (very few).
When you have this problem, the
dmesg
's output is OK, logs are clean and ip addr
will report normal status... and actually everything appears normal.If you cannot browse any website, but you can ping some random hosts, chances are great that you are experiencing this problem: ping uses ICMP and is not affected by TCP problems.
You can try to use Wireshark. You might see successful UDP and ICMP communications but unsuccessful TCP communications (only to foreign hosts).
Ways of fixing it
Bad
To fix it the bad way, you can change the
tcp_rmem
value, on which Scale Factor calculation is based. Although it should work for most hosts, it is not guaranteed, especially for very distant ones.Good
Simply disable Window Scaling. Since Window Scaling is a nice TCP feature, it may be uncomfortable to disable it, especially if you cannot fix the broken router. There are several ways to disable Window Scaling, and it seems that the most bulletproof way (which will work with most kernels) is to add the following line to
/etc/sysctl.d/99-disable_window_scaling.conf
(see also sysctl):Best
This problem is caused by broken routers/firewalls, so let us change them. Some users have reported that the broken router was their very own DSL router.
More about it
This section is based on the LWN article TCP window scaling and broken routers and an archived Kernel Trap article: Window Scaling on the Internet.
There are also several relevant threads on the LKML.
Connected second PC unable to use bridged LAN
First PC have two LAN. Second PC have one LAN and connected to first PC. Lets go second PC to give all access to LAN after bridged interface:
This article or section needs expansion.
Reason: Explain what the settings actually do. (Discuss in Talk:Network configuration#)
See also
Retrieved from 'https://wiki.archlinux.org/index.php?title=Network_configuration&oldid=639118'
- 2Network Backends
- 2.2Network backend types
- 2.2.1User Networking (SLIRP)
- 2.2Network backend types
- 3Virtual Network Devices
- 5Network HOWTOs
- 6Misc
- 6.2Guest Hints
There are two parts to networking within QEMU:
- the virtual network device that is provided to the guest (e.g. a PCI network card).
- the network backend that interacts with the emulated NIC (e.g. puts packets onto the host's network).
There are a range of options for each part. By default QEMU will create a SLiRP user network backend and an appropriate virtual network device for the guest (eg an E1000 PCI card for most x86 PC guests), as if you had typed -net nic -net user on your command line.
Note - if you specify any networking options on the command line (via -net or -netdev) then QEMU will require you to provide options sufficient to define and connect up both parts. (Forgetting to specify the backend or the network device will give a warning message such as 'Warning: netdev mynet0 has no peer', 'Warning: hub 0 is not connected to host network' or 'Warning: hub 0 with no nics'; the VM will then boot but will not have functioning networking.)
Note - if you are using the (default) SLiRP user networking, then ping (ICMP) will not work, though TCP and UDP will. Don't try to use ping to test your QEMU network configuration!
Note - As this page is probably very brief or even incomplete you might find these pages rather useful:
- QEMU Networking on wikibooks.org, mainly dealing with Linux hosts
- QEMU Networking on bsdwiki, showing used networking principles and dealing with BSD hosts
How to create a network backend?
There are a number of network backends to choose from depending on your environment. Create a network backend like this:
The id option gives the name by which the virtual network device and the network backend are associated with each other. If you want multiple virtual network devices inside the guest they each need their own network backend. The name is used to distinguish backends from each other and must be used even when only one backend is specified.
Network backend types
In most cases, if you don't have any specific networking requirements other than to be able to access to a web page from your guest, user networking (slirp) is a good choice. However, if you are looking to run any kind of network service or have your guest participate in a network in any meaningful way, tap is usually the best choice.
User Networking (SLIRP)
This is the default networking backend and generally is the easiest to use. It does not require root / Administrator privileges.It has the following limitations:
- there is a lot of overhead so the performance is poor
- in general, ICMP traffic does not work (so you cannot use ping within a guest)
- on Linux hosts, ping does work from within the guest, but it needs initial setup by root (once per host) -- see the steps below
- the guest is not directly accessible from the host or the external network
User Networking is implemented using 'slirp', which provides a full TCP/IP stack within QEMU and uses that stack to implement a virtual NAT'd network.
A typical (default) network is shown below.
Note that from inside the guest, connecting to a port on the 'gateway' IP address will connect to that port on the host; so for instance 'ssh 10.0.2.2' will ssh from the guest to the host.
You can configure User Networking using the -netdev user command line option.
Adding the following to the qemu command line will change the network configuration to use 192.168.76.0/24 instead of the default (10.0.2.0/24) and will start guest DHCP allocation from 9 (instead of 15):
You can isolate the guest from the host (and broader network) using the restrict option. For example -netdev user,id=mynet0,restrict=y or -netdev type=user,id=mynet0,restrict=yes will restrict networking to just the guest and any virtual devices. This can be used to prevent software running inside the guest from phoning home while still providing a network inside the guest. You can selectively override this using hostfwd and guestfwd options.
Enabling ping in the guest, on Linux hosts
- Determine the main group ID (or one supplementary group ID) of the user that will run QEMU with slirp.
- In /etc/sysctl.conf (or whatever is appropriate for your host distro), make sure that the whitespace-separated, inclusive group ID range in the net.ipv4.ping_group_range sysctl includes the above group ID.
For example, as root,
- add a new group called unpriv_ping:
- set this group for a number of users as another supplementary group (note, they will have to re-login):
- then set both sides of the inclusive range in the above sysctl to the numeric ID of the new group:
Advanced user networking options
The -netdev user parameter has some more useful options:
- The DHCP address and name for the guest can be set with -netdev user,id=n0,host=addr,hostname=name
- You can specify the guest-visible virtual DNS server address with -netdev user,id=n0,dns=addr
- QEMU can simulate a TFTP server with -netdev user,id=n0,tftp=xxx,bootfile=yyy
- To share files between your guest and host, you can use -netdev user,id=n0,smb=dir,smbserver=addr
- To forward host ports to your guest, use -netdev user,id=n0,hostfwd=hostip:hostport-guestip:guestport
For details, please see the QEMU documentation.
Tap
The tap networking backend makes use of a tap networking device in the host. It offers very good performance and can be configured to create virtually any type of network topology. Unfortunately, it requires configuration of that network topology in the host which tends to be different depending on the operating system you are using. Generally speaking, it also requires that you have root privileges.
VDE
The VDE networking backend uses the Virtual Distributed Ethernet infrastructure to network guests. Unless you specifically know that you want to use VDE, it is probably not the right backend to use.
Socket
The socket networking backend allows you to create a network of guests that can see each other. It's primarily useful in extending the network created by the SLIRP backend to multiple virtual machines. In general, if you want to have multiple guests communicate, the tap backend is a better choice unless you do not have root access to the host environment.
How to create a virtual network device?
The virtual network device that you choose depends on your needs and the guest environment (i.e. the hardware that you are emulating). For example, if you are emulating a particular embedded board, then you should use the virtual network device that comes with embedded board's configuration. Such on-board NICs can be configured with the -nic option of QEMU. See the corresponding section below for details.
On machines that have a PCI bus (or any other pluggable bus system), there are a wider range of options. For example, the e1000 is the default network adapter on some machines in QEMU. Other older guests might require the rtl8139 network adapter. For modern guests, the virtio-net (para-virtualised) network adapter should be used instead since it has the best performance, but it requires special guest driver support which might not be available on very old operating systems.
Use the -device option to add a particular virtual network device to your virtual machine:
The netdev is the name of a previously defined -netdev. The virtual network device will be associated with this network backend.
Note that there are other device options to select alternative devices, or to change some aspect of the device. For example, you want something like:-device DEVNAME,netdev=NET-ID,mac=MACADDR,DEV-OPTS, where DEVNAME is the device (e.g. i82559c for an Intel i82559C Ethernet device), NET_ID is the network identifier to attach the device to (see discussion of -netdev below), MACADDR is the MAC address for the device, and DEV-OPTS are any additional device options that you may wish to pass (e.g. bus=PCI-BUS,addr=DEVFN to control the PCI device address), if supported by the device.
Use -device help to get a list of the devices (including network devices) you can add using the -device option for a particular guest.
The -nic option
In case you don't care about configuring every detail of a NIC, you can also create a NIC together with a host backend by using the -nic parameter. For example, you can replace
with:
Use -nic model=help to get a list of the supported NIC models.
If you don't care about the NIC model, you can also omit that option. So the shortest way to get a tap device is for example simply:
The NIC option should also be use to configure NICs on embedded systems (which can not be used via -device). For example, to connect such an on-board NIC to the tap backend and change its MAC-address, you can use the -nic option like this:
You can monitor the network configuration using info network and info usernet commands.
You can capture network traffic from within QEMU using the filter-dump object, like this:
Once you've shut down QEMU, you can examine the dump.dat file with tools like Wireshark. Please note that network traffic dumping can only work if QEMU has a chance to see the network packets, i.e. this does not work if you use virtio-net with vhost acceleration in the kernel.
How to get SSH access to a guest
A simplest way is to forward a specific host port to guest port 22. It can be done via:
The first line creates a virtual e1000 network device, while the second line created one user typed backend, forwarding local port 5555 to guest port 22. Then we can do:
to have SSH access to guest after its network setup (don't forget to turn off firewalls if there is any in the guest or host).
How to use tap with a wireless adapter on the host
See this:
How to disable network completely
If you don't specify any network configuration options, then QEMU will create a SLiRP user network backend and an appropriate virtual network device for the guest (eg an E1000 PCI card for most x86 PC guests). If you don't want any networking at all you can suppress this default with:
The more general option -nodefaults also suppresses the default networking configuration, as well as the creation of several other default devices.
Setting up taps on Linux
For Linux with iproute2 and tap/tun support, this can be configured as below, and assumes the reader has experience using iproute2 (at least ip-addr and ip-link). Take note of the host's physical devices' configuration, as the bridge created will become the new endpoint for the physical device. Note that this WILL cause the host's networking on that physical device to go out, possibly requiring a reboot for remote systems!
At this point, the bridge works, but is not usable as it does not have an IP address. For reassigning the physical device's addresses for the bridge to be usable:
Mac Configuration Manager
This can be automated with a shell script to setup tap networking on remote hosts; as mentioned above, connection will be lost upon setting the physical device's master to a bridge.
Please note that the newly-created tap device's link may need to be set to UP via ip-link after a virtual machine has been started. Furthermore, as a bridge device basically acts as the new endpoint for a physical device, most normal networking commands, such as a DHCP client or packet sniffer, must be ran on the bridge instead of the physical device. Creating multiple bridges per interface is known (anecdotally) to be problematic; instead, create a tap for each virtual machine using a single bridge for each physical device to be used.
TODO LIST
Network Configuration For Mac High Sierra
- Use tap to let guests be visible on the host network for non-Linux.
- Pass QEMU a physical card rather than emulation/simulation.
The legacy -net option
QEMU previously used the -net nic option instead of -device DEVNAME and -net TYPE instead of -netdev TYPE. This is considered obsolete since QEMU 0.12, although it continues to work.The legacy syntax to create virtual network devices is:
You can use -net nic,model=? to get a list of valid network devices that you can pass to the -net nic option. Note that these model names might be different from the -device ? names and are therefore only useful if you are using the -net nic,model=MODEL syntax.
The obsolete -net syntax automatically created an emulated hub with ID 0 (used to be called a 'VLAN' in older versions of QEMU, for virtual LAN) that forwards traffic from any device connected to it to every other device on the 'VLAN'. If you need more than one hub in recent versions of QEMU, you can do this with the 'hubport' backend, e.g. by using -nic hubport,hubid=1.
Guest Hints
Linux
Should work using default network settings.
Mac OS 9
If having problems, open the TCP/IP control panel. Under 'Connect via:' select Ethernet. Under 'Configure' select 'Using DHCP Server'. Close the control panel. Wait a few seconds then try opening it again. The fields in the window should have been auto-populated.
Mac OS 10.2
Starting with QEMU 2.11, the SunGEM NIC can be used. Open the System Preferences, go to the Network pane. You should see a dialog box telling you it has found a new network interface card. Click the Ok button. Click the 'Apply Now' Button at the bottom of the window. The fields in the TCP/IP tab should populate.
Mac OS 10.4
or
Open System Preferences and go to the Network pane. Select the Ethernet Adapter from the 'Show' drop down menu. From the TCP/IP tab, push the Apply Now button at the bottom. This will make the nic work.
Windows NT 4.0
Windows 2000, Windows XP, Windows 7
Windows will automatically detect and use the NIC.
React OS
Retrieved from 'https://wiki.qemu.org/index.php?title=Documentation/Networking&oldid=9072'