diff options
Diffstat (limited to 'passt.1')
| -rw-r--r-- | passt.1 | 563 |
1 files changed, 309 insertions, 254 deletions
@@ -85,6 +85,11 @@ Be verbose, don't log to the system logger. Be extra verbose, show single packets. Implies \fB--debug\fR. .TP +.BR \-\-stats " " \fIDELAY\fR +Display events statistics with a minimum \fIDELAY\fR seconds between updates. +If there is no event, statistics are not displayed. + +.TP .BR \-q ", " \-\-quiet Don't print informational messages. @@ -123,6 +128,11 @@ initial effective UID 0 or CAP_SETUID capability) to work. Default is to change to user \fInobody\fR if started as root. .TP +.BR \-c ", " \-\-conf-path " " \fIpath " " (EXPERIMENTAL) +Path for configuration and control socket used by \fBpesto\fR(1) to +dynamically update passt or pasta's configuration. + +.TP .BR \-h ", " \-\-help Display a help message and exit. @@ -151,26 +161,35 @@ By default, the advertised MTU is 65520 bytes, that is, the maximum 802.3 MTU minus the length of a 802.3 header, rounded to 32 bits (IPv4 words). .TP -.BR \-a ", " \-\-address " " \fIaddr +.BR \-a ", " \-\-address " " \fIaddr\fR[/\fIprefix_len\fR] Assign IPv4 \fIaddr\fR via DHCP (\fByiaddr\fR), or \fIaddr\fR via DHCPv6 (option 5) and an \fIaddr\fR-based prefix via NDP Router Advertisement (option type 3) for an IPv6 \fIaddr\fR. +An optional /\fIprefix_len\fR (0-32 for IPv4, 0-128 for IPv6) can be +appended in CIDR notation (e.g. 192.0.2.1/24). This is an alternative to +using the \fB-n\fR, \fB--netmask\fR option. Mixing CIDR notation with +\fB-n\fR results in an error. +If a prefix length is assigned to an IPv6 address using this method, it will +in the current code version be overridden by the default value of 64. This option can be specified zero (for defaults) to two times (once for IPv4, once for IPv6). By default, assigned IPv4 and IPv6 addresses are taken from the host interfaces with the first default route, if any, for the corresponding IP version. If no default routes are available and there is any interface with any route for a given IP version, the first of these interfaces will be chosen instead. If no -such interface exists, the link-local address 169.254.2.1 is assigned for IPv4, -and no additional address will be assigned for IPv6. +such interface exists for a given IP version, the link-local address 169.254.2.1 +is assigned for IPv4, and no additional address will be assigned for IPv6. .TP .BR \-n ", " \-\-netmask " " \fImask Assign IPv4 netmask \fImask\fR, expressed as dot-decimal or number of bits, via -DHCP (option 1). -By default, the netmask associated to the host address matching the assigned one -is used. If there's no matching address on the host, the netmask is determined -according to the CIDR block of the assigned address (RFC 4632). +DHCP (option 1). Alternatively, the prefix length can be specified using CIDR +notation with the \fB-a\fR, \fB--address\fR option (e.g. \fB-a\fR 192.0.2.1/24). +Mixing \fB-n\fR with CIDR notation results in an error. +If no address is indicated, the netmask associated with the adopted host address, +if any, is used. If an address is indicated, but without a prefix length, the +netmask is determined based on the corresponding network class. In all other +cases, the netmask is determined by using the indicated prefix length. .TP .BR \-M ", " \-\-mac-addr " " \fIaddr @@ -189,9 +208,9 @@ first default route, if any, for the corresponding IP version. If the default route is a multipath one, the gateway is the first nexthop router returned by the kernel which has the highest weight in the set of paths. If no default routes are available and there is just one interface with any route, that -interface will be chosen instead. If no such interface exists, the link-local -address 169.254.2.2 is used for IPv4, and the link-local address fe80::1 is used -for IPv6. +interface will be chosen instead. If no such interface exists for a given IP +version, the link-local address 169.254.2.2 is used for IPv4, and the link-local +address fe80::1 is used for IPv6. Note: these addresses are also used as source address for packets directed to the guest or to the target namespace having a loopback or local source address, @@ -319,8 +338,8 @@ silently dropped. .TP .BR \-\-no-icmp -Disable the ICMP/ICMPv6 echo handler. ICMP and ICMPv6 echo requests coming from -guest or target namespace will be silently dropped. +Disable the ICMP/ICMPv6 protocol handler. ICMP and ICMPv6 requests coming from +guest or target namespace will be silently dropped. Implies \fB--no-ndp\fR. .TP .BR \-\-no-dhcp @@ -330,8 +349,8 @@ selected IPv4 default route. .TP .BR \-\-no-ndp -Disable NDP responses. NDP messages coming from guest or target namespace will -be ignored. +Disable Neighbor Discovery. NDP messages coming from guest or target +namespace will be ignored. No initial NDP message will be sent. .TP .BR \-\-no-dhcpv6 @@ -375,6 +394,16 @@ default route, or if there is no default route, for any of the enabled address families. .TP +.BR \-\-chroot-fallback +Enable fallback to chroot() in case pivot_root(), used to switch to an empty +filesystem for stricter isolation, returns an error. Useful for integrations +which use tmpfs or initramfs as root filesystem, where pivot_root() can't be +used, as it results in an invalid argument error (EINVAL). + +By default, the fallback is disabled. If pivot_root() fails, then the entire +sandboxing process fails. + +.TP .BR \-\-map-guest-addr " " \fIaddr Translate \fIaddr\fR in the guest to be equal to the guest's assigned address on the host. That is, packets from the guest to \fIaddr\fR @@ -401,85 +430,100 @@ Enable IPv6-only operation. IPv4 traffic will be ignored. By default, IPv4 operation is enabled as long as at least an IPv4 route and an interface address are configured on a given host interface. -.SS \fBpasst\fR-only options +.TP +.BR \-H ", " \-\-hostname " " \fIname +Hostname to configure the client with. +Send \fIname\fR as DHCP option 12 (hostname). .TP -.BR \-s ", " \-\-socket-path ", " \-\-socket " " \fIpath -Path for UNIX domain socket used by \fBqemu\fR(1) or \fBqrap\fR(1) to connect to -\fBpasst\fR. -Default is to probe a free socket, not accepting connections, starting from -\fI/tmp/passt_1.socket\fR to \fI/tmp/passt_64.socket\fR. +.BR \-\-fqdn " " \fIname +FQDN to configure the client with. +Send \fIname\fR as Client FQDN: DHCP option 81 and DHCPv6 option 39. .TP -.BR \-\-vhost-user -Enable vhost-user. The vhost-user command socket is provided by \fB--socket\fR. +.BR \-t ", " \-\-tcp-ports " " \fIspec +Configure TCP port forwarding to guest or namespace. \fIspec\fR can be either: +.RS .TP -.BR \-\-print-capabilities -Print back-end capabilities in JSON format, only meaningful for vhost-user mode. +.BR none +Don't forward any ports +or .TP -.BR \-F ", " \-\-fd " " \fIFD -Pass a pre-opened, connected socket to \fBpasst\fR. Usually the socket is opened -in the parent process and \fBpasst\fR inherits it when run as a child. This -allows the parent process to open sockets using another address family or -requiring special privileges. +[\fIaddress\fR[\fB%\fR\fIinterface\fR]\fB/\fR]\fIports\fR ... -This option implies the behaviour described for \-\-one-off, once this socket -is closed. +Ports to forward. Optionally, a specific listening address and +interface name (since Linux 5.7) can be specified. +.RE +\fIports\fR is a comma-separated list of entries which may be any of: .TP -.BR \-1 ", " \-\-one-off -Quit after handling a single client connection, that is, once the client closes -the socket, or once we get a socket error. - +\fIfirst\fR[\fB-\fR\fIlast\fR][\fB:\fR[\fItoaddr\fR\fB/\fR]\fItofirst\fR[\fB-\fR\fItolast\fR]] .TP -.BR \-t ", " \-\-tcp-ports " " \fIspec -Configure TCP port forwarding to guest. \fIspec\fR can be one of: -.RS +\fIfirst\fR[\fB-\fR\fIlast\fR][\fB:\fR\fItoaddr\fR] +Include range. Forward port numbers between \fIfirst\fR and \fIlast\fR +(inclusive) to ports between \fItofirst\fR and \fItolast\fR to address +\fItoaddr\fR. If \fItoaddr\fR is omitted, automatically determine the +guest or namespace address. If \fItofirst\fR and \fItolast\fR are +omitted, assume the same as \fIfirst\fR and \fIlast\fR. If \fIlast\fR +is omitted, assume the same as \fIfirst\fR. .TP -.BR none -Don't forward any ports +\fB~\fR\fIfirst\fR[\fB-\fR\fIlast\fR] +Exclude range. Don't forward port numbers between \fIfirst\fR and +\fIlast\fR. This takes precedences over include ranges. .TP -.BR all -Forward all unbound, non-ephemeral ports, as permitted by current capabilities. -For low (< 1024) ports, see \fBNOTES\fR. No failures are reported for +.BR all\fR[\fB:\fItoaddr\fR] +Forward all unbound, non-ephemeral ports, not covered by exclude +ranges above, as permitted by current capabilities, to the +corresponding ports on address \fItoaddr\fR. If \fItoaddr\fR is +omitted, automatically determine the guest or namespace address. For +low (< 1024) ports, see \fBNOTES\fR. No failures are reported for unavailable ports, unless no ports could be forwarded at all. .TP -.BR ports -A comma-separated list of ports, optionally ranged with \fI-\fR, and, -optionally, with target ports after \fI:\fR, if they differ. Specific addresses -can be bound as well, separated by \fI/\fR, and also, since Linux 5.7, limited -to specific interfaces, prefixed by \fI%\fR. Within given ranges, selected ports -and ranges can be excluded by an additional specification prefixed by \fI~\fR. +.BR auto +\fBpasta\fR only. Only forward ports in the specified set if the +target ports are bound in the namespace. The list of ports is +periodically derived (every second) from listening sockets reported by +\fI/proc/net/tcp\fR and \fI/proc/net/tcp6\fR, see \fBproc\fR(5). +.RE -Specifying excluded ranges only implies that all other ports are forwarded. In -this case, no failures are reported for unavailable ports, unless no ports could +Specifying excluded ranges only implies that all other non-ephemeral ports +are forwarded. Specifying no ranges is equivalent to '\fBall\fR'. In this +case, no failures are reported for unavailable ports, unless no ports could be forwarded at all. Examples: .RS .TP +-t all +Forward all unbound, non-ephemeral ports as permitted by current +capabilities to the corresponding port on the guest or namespace +.TP +-t ::1/all +For the local address ::1, forward all unbound, non-ephemeral ports as +permitted by current capabilities +.TP -t 22 -Forward local port 22 to port 22 on the guest +Forward local port 22 to port 22 on the guest or namespace .TP -t 22:23 -Forward local port 22 to port 23 on the guest +Forward local port 22 to port 23 on the guest or namespace .TP -t 22,25 -Forward local ports 22 and 25 to ports 22 and 25 on the guest +Forward local ports 22 and 25 to ports 22 and 25 on the guest or namespace .TP -t 22-80 -Forward local ports between 22 and 80 to corresponding ports on the guest +Forward local ports between 22 and 80 to corresponding ports on the guest or namespace .TP -t 22-80:32-90 -Forward local ports between 22 and 80 to ports between 32 and 90 on the guest +Forward local ports between 22 and 80 to ports between 32 and 90 on the guest or namespace .TP -t 192.0.2.1/22 -Forward local port 22, bound to 192.0.2.1, to port 22 on the guest +Forward local port 22, bound to 192.0.2.1, to port 22 on the guest or namespace .TP -t 192.0.2.1%eth0/22 Forward local port 22, bound to 192.0.2.1 and interface eth0, to port 22 @@ -487,6 +531,14 @@ Forward local port 22, bound to 192.0.2.1 and interface eth0, to port 22 -t %eth0/22 Forward local port 22, bound to any address on interface eth0, to port 22 .TP +-t 0.0.0.0/5000:192.0.2.5/6000 +Forward local port 5000, bound to any IPv4 address, to port 6000 on address 192.0.2.5. +.TP +-t 127.0.0.6/all:192.0.2.6 +For the local address 127.0.0.6, forward all unbound, non-ephemeral +ports as permitted by current capabilities to the corresponding port +on 192.0.2.6. +.TP -t 2000-5000,~3000-3010 Forward local ports between 2000 and 5000, except for those between 3000 and 3010 @@ -497,9 +549,20 @@ and 30 .TP -t ~20000-20010 Forward all ports to the guest, except for the range from 20000 to 20010 +.TP +-t auto +Automatically forward any ports which are bound in the namespace +.TP +-t ::1/auto +Automatically forward any ports which are bound in the namespace, +listening only on local address ::1 +.TP +-t 8000-8010,auto +Forward ports in the range 8000-8010 if and only if they are bound in +the namespace .RE -Default is \fBnone\fR. +Default is \fBnone\fR for \fBpasst\fR and \fBauto\fR for \fBpasta\fR. .RE .TP @@ -511,101 +574,86 @@ Note: unless overridden, UDP ports with numbers corresponding to forwarded TCP port numbers are forwarded too, without, however, any port translation. IPv6 bound ports are also forwarded for IPv4. -Default is \fBnone\fR. +Default is \fBnone\fR for \fBpasst\fR and \fBauto\fR for \fBpasta\fR. -.SS \fBpasta\fR-only options +.SS \fBpasst\fR-only options .TP -.BR \-I ", " \-\-ns-ifname " " \fIname -Name of tap interface to be created in target namespace. -By default, the same interface name as the external, routable interface is used. -If no such interface exists, the name \fItap0\fR will be used instead. +.BR \-s ", " \-\-socket-path ", " \-\-socket " " \fIpath +Path for UNIX domain socket used by \fBqemu\fR(1) to connect to \fBpasst\fR. +Default is to probe a free socket, not accepting connections, starting from +\fI/tmp/passt_1.socket\fR to \fI/tmp/passt_64.socket\fR. .TP -.BR \-t ", " \-\-tcp-ports " " \fIspec -Configure TCP port forwarding to namespace. \fIspec\fR can be one of: -.RS +.BR \-\-vhost-user +Enable vhost-user. The vhost-user command socket is provided by \fB--socket\fR. .TP -.BR none -Don't forward any ports +.BR \-\-print-capabilities +Print back-end capabilities in JSON format, only meaningful for vhost-user mode. .TP -.BR auto -Dynamically forward ports bound in the namespace. The list of ports is -periodically derived (every second) from listening sockets reported by -\fI/proc/net/tcp\fR and \fI/proc/net/tcp6\fR, see \fBproc\fR(5). +.BR \-\-repair-path " " \fIpath +Path for UNIX domain socket used by the \fBpasst-repair\fR(1) helper to connect +to \fBpasst\fR in order to set or clear the TCP_REPAIR option on sockets, during +migration. \fB--repair-path none\fR disables this interface (if you need to +specify a socket path called "none" you can prefix the path by \fI./\fR). + +Default, for \-\-vhost-user mode only, is to append \fI.repair\fR to the path +chosen for the hypervisor UNIX domain socket. No socket is created if not in +\-\-vhost-user mode. .TP -.BR ports -A comma-separated list of ports, optionally ranged with \fI-\fR, and, -optionally, with target ports after \fI:\fR, if they differ. Specific addresses -can be bound as well, separated by \fI/\fR, and also, since Linux 5.7, limited -to specific interfaces, prefixed by \fI%\fR. Within given ranges, selected ports -and ranges can be excluded by an additional specification prefixed by \fI~\fR. +.BR \-\-migrate-exit " " (DEPRECATED) +Exit after a completed migration as source. By default, \fBpasst\fR keeps +running and the migrated guest can continue using its connection, or a new guest +can connect. -Specifying excluded ranges only implies that all other ports are forwarded. In -this case, no failures are reported for unavailable ports, unless no ports could -be forwarded at all. +Note that this configuration option is \fBdeprecated\fR and will be removed in a +future version. It is not expected to be of any use, and it simply reflects a +legacy behaviour. If you have any use for this, refer to \fBREPORTING BUGS\fR +below. -Examples: -.RS -.TP --t 22 -Forward local port 22 to 22 in the target namespace -.TP --t 22:23 -Forward local port 22 to port 23 in the target namespace -.TP --t 22,25 -Forward local ports 22 and 25 to ports 22 and 25 in the target namespace .TP --t 22-80 -Forward local ports between 22 and 80 to corresponding ports in the target -namespace -.TP --t 22-80:32-90 -Forward local ports between 22 and 80 to ports between 32 and 90 in the target -namespace -.TP --t 192.0.2.1/22 -Forward local port 22, bound to 192.0.2.1, to port 22 in the target namespace -.TP --t 192.0.2.1%eth0/22 -Forward local port 22, bound to 192.0.2.1 and interface eth0, to port 22 -.TP --t %eth0/22 -Forward local port 22, bound to any address on interface eth0, to port 22 -.TP --t 2000-5000,~3000-3010 -Forward local ports between 2000 and 5000, except for those between 3000 and -3010 -.TP --t 192.0.2.1/20-30,~25 -For the local address 192.0.2.1, forward ports between 20 and 24 and between 26 -and 30 -.TP --t ~20000-20010 -Forward all ports to the namespace, except for those between 20000 and 20010 -.RE +.BR \-\-migrate-no-linger " " (DEPRECATED) +Close TCP sockets on the source instance once migration completes. -IPv6 bound ports are also forwarded for IPv4. +By default, sockets are kept open, and events on data sockets are ignored, so +that any further message reaching sockets after the source migrated is silently +ignored, to avoid connection resets in case data is received after migration. -Default is \fBauto\fR. -.RE +Note that this configuration option is \fBdeprecated\fR and will be removed in a +future version. It is not expected to be of any use, and it simply reflects a +legacy behaviour. If you have any use for this, refer to \fBREPORTING BUGS\fR +below. .TP -.BR \-u ", " \-\-udp-ports " " \fIspec -Configure UDP port forwarding to namespace. \fIspec\fR is as described for TCP -above, and the list of ports is derived from listening sockets reported by -\fI/proc/net/udp\fR and \fI/proc/net/udp6\fR, see \fBproc\fR(5). +.BR \-F ", " \-\-fd " " \fIFD +Pass a pre-opened, connected socket to \fBpasst\fR. Usually the socket is opened +in the parent process and \fBpasst\fR inherits it when run as a child. This +allows the parent process to open sockets using another address family or +requiring special privileges. -Note: unless overridden, UDP ports with numbers corresponding to forwarded TCP -port numbers are forwarded too, without, however, any port translation. +This option implies the behaviour described for \-\-one-off, once this socket +is closed. -IPv6 bound ports are also forwarded for IPv4. +.TP +.BR \-1 ", " \-\-one-off +Quit after handling a single client connection, that is, once the client closes +the socket, or once we get a socket error. -Default is \fBauto\fR. +\fBNote\fR: this option has no effect after \fBpasst\fR completes a migration as +source, because, in that case, exiting would close sockets for active +connections, which would in turn cause connection resets if any further data is +received. See also the description of \fI\-\-migrate-no-linger\fR. + +.SS \fBpasta\fR-only options + +.TP +.BR \-I ", " \-\-ns-ifname " " \fIname +Name of tap interface to be created in target namespace. +By default, the same interface name as the external, routable interface is used. +If no such interface exists, the name \fItap0\fR will be used instead. .TP .BR \-T ", " \-\-tcp-ns " " \fIspec @@ -623,10 +671,11 @@ Default is \fBauto\fR. .TP .BR \-\-host-lo-to-ns-lo -If specified, connections forwarded with \fB\-t\fR and \fB\-u\fR from -the host's loopback address will appear on the loopback address in the -guest as well. Without this option such forwarded packets will appear -to come from the guest's public address. +If specified, connections to a host loopback address forwarded with +\fB\-t\fR or \fB\-u\fR will be delivered to the same loopback address +in the namespace. Without this option such connections are forwarded +to the namespace's public address. This option is incompatible with +\fB--no-splice\fR. .TP .BR \-\-userns " " \fIspec @@ -700,6 +749,11 @@ Default is to let the tap driver build a pseudorandom hardware address. Disable the bypass path for inbound, local traffic. See the section \fBHandling of local traffic in pasta\fR in the \fBNOTES\fR for more details. +.TP +.BR \-\-splice-only +Do not create a tap device in the namespace. In this mode, \fIpasta\fR only +forwards loopback traffic between namespaces. + .SH EXAMPLES .SS \fBpasta @@ -707,129 +761,132 @@ of local traffic in pasta\fR in the \fBNOTES\fR for more details. .RS .nf $ iperf3 -s -D -$ ./pasta -Outbound interface: eth0, namespace interface: eth0 -ARP: - address: 28:16:ad:39:a9:ea -DHCP: - assign: 192.168.1.118 - mask: 255.255.255.0 - router: 192.168.1.1 -NDP/DHCPv6: - assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17 - router: fe80::62e3:27ff:fe33:2b01 -# -# dhclient -4 --no-pid -# dhclient -6 --no-pid + +$ pasta --config-net + # ip address show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever - inet6 ::1/128 scope host + inet6 ::1/128 scope host proto kernel_lo valid_lft forever preferred_lft forever -2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UNKNOWN group default qlen 1000 - link/ether 5e:90:02:eb:b0:2a brd ff:ff:ff:ff:ff:ff - inet 192.168.1.118/24 brd 192.168.1.255 scope global eth0 +2: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc fq_codel state UNKNOWN group default qlen 1000 + link/ether be:16:49:5a:65:dc brd ff:ff:ff:ff:ff:ff + inet 88.198.0.164/27 brd 88.198.0.191 scope global noprefixroute enp9s0 valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17/128 scope global + inet6 2a01:4f8:222:904::2/64 scope global nodad valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:5c90:2ff:feeb:b02a/64 scope global dynamic mngtmpaddr - valid_lft 3591sec preferred_lft 3591sec - inet6 fe80::5c90:2ff:feeb:b02a/64 scope link + inet6 fe80::bc16:49ff:fe5a:65dc/64 scope link nodad proto kernel_ll valid_lft forever preferred_lft forever + # ip route show -default via 192.168.1.1 dev eth0 -192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.118 +default via 88.198.0.161 dev enp9s0 proto dhcp metric 1002 +88.198.0.160/27 dev enp9s0 proto dhcp scope link metric 1002 + # ip -6 route show -2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17 dev eth0 proto kernel metric 256 pref medium -2a02:6d40:3ca5:2001::/64 dev eth0 proto kernel metric 256 expires 3584sec pref medium -fe80::/64 dev eth0 proto kernel metric 256 pref medium -default via fe80::62e3:27ff:fe33:2b01 dev eth0 proto ra metric 1024 expires 3584sec pref medium +2a01:4f8:222:904::/64 dev enp9s0 proto kernel metric 256 pref medium +fe80::/64 dev enp9s0 proto kernel metric 256 pref medium +default via fe80::1 dev enp9s0 metric 1024 onlink pref medium + # iperf3 -c 127.0.0.1 -t1 Connecting to host 127.0.0.1, port 5201 -[ 5] local 127.0.0.1 port 51938 connected to 127.0.0.1 port 5201 +[ 5] local 127.0.0.1 port 59112 connected to 127.0.0.1 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd -[ 5] 0.00-1.00 sec 4.46 GBytes 38.3 Gbits/sec 0 3.93 MBytes +[ 5] 0.00-1.00 sec 3.89 GBytes 33.4 Gbits/sec 0 2.62 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr -[ 5] 0.00-1.00 sec 4.46 GBytes 38.3 Gbits/sec 0 sender -[ 5] 0.00-1.41 sec 4.45 GBytes 27.1 Gbits/sec receiver +[ 5] 0.00-1.00 sec 3.89 GBytes 33.4 Gbits/sec 0 sender +[ 5] 0.00-1.00 sec 3.89 GBytes 33.4 Gbits/sec receiver iperf Done. + # iperf3 -c ::1 -t1 Connecting to host ::1, port 5201 -[ 5] local ::1 port 50108 connected to ::1 port 5201 +[ 5] local ::1 port 49138 connected to ::1 port 5201 [ ID] Interval Transfer Bitrate Retr Cwnd -[ 5] 0.00-1.00 sec 4.35 GBytes 37.4 Gbits/sec 0 4.99 MBytes +[ 5] 0.00-1.00 sec 4.32 GBytes 37.0 Gbits/sec 0 1.06 MBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr -[ 5] 0.00-1.00 sec 4.35 GBytes 37.4 Gbits/sec 0 sender -[ 5] 0.00-1.41 sec 4.35 GBytes 26.4 Gbits/sec receiver +[ 5] 0.00-1.00 sec 4.32 GBytes 37.0 Gbits/sec 0 sender +[ 5] 0.00-1.00 sec 4.32 GBytes 37.0 Gbits/sec receiver iperf Done. -# ping -c1 -4 spaghetti.pizza -PING spaghetti.pizza (172.67.192.217) 56(84) bytes of data. -64 bytes from 172.67.192.217: icmp_seq=1 ttl=255 time=37.3 ms + +# ping -nc1 -4 spaghetti.pizza +PING spaghetti.pizza (5.161.47.86) 56(84) bytes of data. +64 bytes from 5.161.47.86: icmp_seq=1 ttl=255 time=99.4 ms --- spaghetti.pizza ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms -# ping -c1 -6 spaghetti.pizza -PING spaghetti.pizza(2606:4700:3034::6815:147a (2606:4700:3034::6815:147a)) 56 data bytes -64 bytes from 2606:4700:3034::6815:147a: icmp_seq=1 ttl=255 time=35.6 ms +rtt min/avg/max/mdev = 99.433/99.433/99.433/0.000 ms +# ping -nc1 -6 spaghetti.pizza +PING spaghetti.pizza (2a01:4f8:1c1e:d6f1::1) 56 data bytes +64 bytes from 2a01:4f8:1c1e:d6f1::1: icmp_seq=1 ttl=255 time=3.11 ms --- spaghetti.pizza ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms -rtt min/avg/max/mdev = 35.605/35.605/35.605/0.000 ms -# logout -$ - -.RE +rtt min/avg/max/mdev = 3.110/3.110/3.110/0.000 ms .fi +.RE .BR "Connect an existing user and network namespace" .RS .nf $ unshare -rUn -# echo $$ -2446678 +# echo $$ +1295969 .fi -.BR " [From another terminal]" + +.BR "[From another terminal]" .nf -$ ./pasta 2446678 -Outbound interface: eth0, namespace interface: eth0 -ARP: - address: 28:16:ad:39:a9:ea +$ pasta --config-net 1295969 +Template interface: enp9s0 (IPv4), enp9s0 (IPv6) +Namespace interface: enp9s0 +MAC: + host: 9a:55:9a:55:9a:55 + NAT to host 127.0.0.1: 88.198.0.161 DHCP: - assign: 192.168.1.118 - mask: 255.255.255.0 - router: 192.168.1.1 + assign: 88.198.0.164 + mask: 255.255.255.224 + router: 88.198.0.161 +DNS: + 185.12.64.1 + 185.12.64.2 + NAT to host ::1: fe80::1 NDP/DHCPv6: - assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17 - router: fe80::62e3:27ff:fe33:2b01 - + assign: 2a01:4f8:222:904::2 + router: fe80::1 + our link-local: fe80::1 +Inbound forwarding rules (HOST): + TCP [*]:1-32767 => 1-32767 (best effort) (auto-scan) + TCP [*]:61000-65535 => 61000-65535 (best effort) (auto-scan) + UDP [*]:1-32767 => 1-32767 (best effort) (auto-scan) + UDP [*]:61000-65535 => 61000-65535 (best effort) (auto-scan) +Outbound forwarding rules (SPLICE): + TCP [*]%lo:1-32767 => 1-32767 (best effort) (auto-scan) + TCP [*]%lo:61000-65535 => 61000-65535 (best effort) (auto-scan) + UDP [*]%lo:1-32767 => 1-32767 (best effort) (auto-scan) + UDP [*]%lo:61000-65535 => 61000-65535 (best effort) (auto-scan) .fi -.BR " [Back to the original terminal]" + +.BR "[Back to the original terminal]" .nf -# dhclient -4 --no-pid -# dhclient -6 --no-pid # ip address show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever - inet6 ::1/128 scope host + inet6 ::1/128 scope host proto kernel_lo valid_lft forever preferred_lft forever -2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UNKNOWN group default qlen 1000 - link/ether fa:c1:2a:27:92:a9 brd ff:ff:ff:ff:ff:ff - inet 192.168.1.118/24 brd 192.168.1.255 scope global eth0 +2: enp9s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc fq_codel state UNKNOWN group default qlen 1000 + link/ether 9a:44:5e:54:d3:2c brd ff:ff:ff:ff:ff:ff + inet 88.198.0.164/27 brd 88.198.0.191 scope global noprefixroute enp9s0 valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17/128 scope global + inet6 2a01:4f8:222:904::2/64 scope global nodad valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:f8c1:2aff:fe27:92a9/64 scope global dynamic mngtmpaddr - valid_lft 3594sec preferred_lft 3594sec - inet6 fe80::f8c1:2aff:fe27:92a9/64 scope link + inet6 fe80::9844:5eff:fe54:d32c/64 scope link nodad proto kernel_ll valid_lft forever preferred_lft forever .fi .RE @@ -838,72 +895,69 @@ NDP/DHCPv6: .BR "Start and connect a guest with basic port forwarding" .RS .nf -$ ./passt -f -t 2222:22 -Outbound interface: eth0 -ARP: - address: 28:16:ad:39:a9:ea +$ passt -f -t 2222:22 +UNIX domain socket bound at /tmp/passt_1.socket +No IPv6 nameserver available for NDP/DHCPv6 +Template interface: enp9s0 (IPv4), enp9s0 (IPv6) +MAC: + host: 9a:55:9a:55:9a:55 + NAT to host 127.0.0.1: 88.198.0.161 DHCP: - assign: 192.168.1.118 - mask: 255.255.255.0 - router: 192.168.1.1 - search: - redhat.com + assign: 88.198.0.164 + mask: 255.255.255.224 + router: 88.198.0.161 +DNS: + 185.12.64.1 + 185.12.64.2 + NAT to host ::1: fe80::1 NDP/DHCPv6: - assign: 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17 - router: fe80::62e3:27ff:fe33:2b01 - search: - redhat.com -UNIX domain socket bound at /tmp/passt_1.socket - -You can now start qrap: - ./qrap 5 qemu-system-x86_64 ... -net socket,fd=5 -net nic,model=virtio -or directly qemu, patched with: - qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-as-net.patch -as follows: - qemu-system-x86_64 ... -net socket,connect=/tmp/passt_1.socket -net nic,model=virtio - + assign: 2a01:4f8:222:904::2 + router: fe80::1 + our link-local: fe80::1 +Inbound forwarding rules (HOST): + TCP [*]:2222 => 22 + +You can now start qemu (>= 7.2, with commit 13c6be96618c): + kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket .fi -.BR " [From another terminal]" -.nf -$ ./qrap 5 qemu-system-x86_64 test.qcow2 -m 1024 -display none -nodefaults -nographic -net socket,fd=5 -net nic,model=virtio -Connected to /tmp/passt_1.socket -.fi -.BR " [Back to the original terminal]" +.BR "[From another terminal]" .nf -passt: DHCP: ack to request -passt: from 52:54:00:12:34:56 -passt: NDP: received NS, sending NA -passt: NDP: received RS, sending RA -passt: DHCPv6: received SOLICIT, sending ADVERTISE -passt: NDP: received NS, sending NA -passt: DHCPv6: received REQUEST/RENEW/CONFIRM, sending REPLY -passt: NDP: received NS, sending NA +$ qemu-system-x86_64 -m 128 test.qcow2 -display none -nodefaults -nographic -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket +.fi +.BR "[Back to the original terminal]" +.nf +accepted connection from PID 1301736 +New guest MAC address observed: 52:54:00:12:34:56 +DHCP: offer to discover + from 52:54:00:12:34:56 +DHCP: ack to request + from 52:54:00:12:34:56 +NDP: received RS, sending RA .fi -.BR " [From yet another terminal]" + +.BR "[From yet another terminal]" .nf $ ssh -p 2222 root@localhost root@localhost's password: .fi -.BR " [...]" +.BR "[...]" .nf # ip address show -1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 +1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever -2: ens2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 qdisc pfifo_fast state UP group default qlen 1000 +2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff - inet 192.168.1.118/24 brd 192.168.1.255 scope global noprefixroute ens2 + inet 88.198.0.164/27 scope global eth0 valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:b81d:fa4a:8cdd:cf17/128 scope global noprefixroute + inet6 2a01:4f8:222:904:5054:ff:fe12:3456/64 scope global dynamic flags 100 valid_lft forever preferred_lft forever - inet6 2a02:6d40:3ca5:2001:b019:9ae2:a2fe:e6b4/64 scope global dynamic noprefixroute - valid_lft 3588sec preferred_lft 3588sec - inet6 fe80::1f98:d09f:9309:9e77/64 scope link noprefixroute + inet6 fe80::5054:ff:fe12:3456/64 scope link valid_lft forever preferred_lft forever .fi .RE @@ -1062,8 +1116,9 @@ throughput of TCP connections. .SS Local mode for disconnected setups If \fBpasst\fR and \fBpasta\fR fail to find a host interface with a configured -address, other than loopback addresses, they will, obviously, not attempt to -source addresses or routes from the host. +address for a given IP version, other than loopback addresses, they will, +obviously, not attempt to source addresses or routes from the host, for that +IP version. In this case, unless configured otherwise, they will assign the IPv4 link-local address 169.254.2.1 to the guest or target namespace, and no IPv6 address. The |
