我运行这个命令:
ip link add dev proof_of_concept_virtual_network_interface type veth
我收到此错误信息:
Error: Attribute failed policy validation.
该错误没有任何描述性或帮助。
我运行这个命令:
ip link add dev proof_of_concept_virtual_network_interface type veth
我收到此错误信息:
Error: Attribute failed policy validation.
该错误没有任何描述性或帮助。
我需要address-list=vpn_list
通过 ovpn 路由一些目标地址。此列表包含全局 IP 地址。
创建附加表:
[admin@Microtik] > /routing/table print detail
Flags: D - dynamic; X - disabled, I - invalid; U - used
0 D name="main" fib
1 name="vpn" fib
添加了 mangle 规则:
[admin@Microtik] > /ip/firewall/mangle print
Flags: X - disabled, I - invalid; D - dynamic
0 D ;;; special dummy rule to show fasttrack counters
chain=prerouting action=passthrough
1 D ;;; special dummy rule to show fasttrack counters
chain=forward action=passthrough
2 D ;;; special dummy rule to show fasttrack counters
chain=postrouting action=passthrough
3 chain=prerouting action=mark-routing new-routing-mark=vpn passthrough=no dst-address-list=vpn_list in-interface-list=LAN log=no log-prefix=""
目的地址:
[admin@Microtik] > /ip/firewall/nat print
Flags: X - disabled, I - invalid; D - dynamic
0 ;;; defconf: masquerade
chain=srcnat action=masquerade out-interface-list=WAN ipsec-policy=out,none
1 chain=srcnat action=masquerade out-interface=ovpn log=no log-prefix=""
并添加路由(一些路由连接不同的LAN(使用另一个l2tp隧道):
[admin@Microtik] > /ip/route print detail
Flags: D - dynamic; X - disabled, I - inactive, A - active;
c - connect, s - static, r - rip, b - bgp, o - ospf, i - is-is, d - dhcp, v - vpn, m - modem, y - bgp-mpls-vpn; H - hw-offloaded; + - ecmp
0 Xs ;;; Old router network
dst-address=192.168.1.0/24 gateway=bridge
1 As dst-address=0.0.0.0/0 routing-table=main gateway=192.168.1.1 immediate-gw=192.168.1.1%ether1 distance=1 scope=30 target-scope=10 suppress-hw-offload=no
DAc dst-address=10.0.0.0/24 routing-table=main gateway=bridge immediate-gw=bridge distance=0 scope=10 suppress-hw-offload=no local-address=10.0.0.1%bridge
2 As ;;; bliz cross network route
dst-address=10.0.1.0/24 routing-table=main pref-src=10.0.0.1 gateway=172.16.0.2 immediate-gw=172.16.0.2%l2tp-bliz distance=1 scope=30 target-scope=10
suppress-hw-offload=no
DAc dst-address=172.16.0.2/32 routing-table=main gateway=l2tp-bliz immediate-gw=l2tp-bliz distance=0 scope=10 suppress-hw-offload=no
local-address=172.16.0.1%l2tp-bliz
3 Is dst-address=192.168.0.0/24 routing-table=main pref-src=10.0.0.1 gateway=l2tp-bliz immediate-gw=l2tp-bliz check-gateway=ping distance=1 scope=30 target-scope=10
suppress-hw-offload=no
DAc dst-address=192.168.1.0/24 routing-table=main gateway=ether1 immediate-gw=ether1 distance=0 scope=10 suppress-hw-offload=no local-address=192.168.1.254%ether1
DAc dst-address=192.168.219.0/24 routing-table=main gateway=ovpn immediate-gw=ovpn distance=0 scope=10 suppress-hw-offload=no local-address=192.168.219.4%ovpn
4 As dst-address=0.0.0.0/0 routing-table=vpn gateway=ovpn immediate-gw=ovpn distance=1 scope=30 target-scope=10 suppress-hw-offload=no
PS:192.168.1.1-WAN 的默认网关。10.0.0.0/24-我的 LAN。
好的?
资源的问题是address-list=vpn_list
工作速度极慢且冻结(通过所需ovpn
界面工作)。当我转到工具并单击 Torch 页面上的“开始”时,一切都变得正常。停止后 - 问题又出现了。
我的错误在哪里?
我试图弄清楚如何使用“ip”命令将“MULITCAST”参数添加到 lo 接口。
我已经有一个 netplan 配置,它将多播路由添加到我的 lo 接口:
224.0.0.0/4 dev lo proto static scope link
但是 lo 接口需要能够参与多播消息传递。
示例:当前配置:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
所需的配置(注意 MULTICAST 的存在):
1: lo: <LOOPBACK,MULTICAST,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
在 ifconfig 日子里,我会发出: ifconfig lo mulitcast
如何使用 ip 命令完成此操作?(在 Ubuntu 22.04 上默认不安装 ifconfig)
使用iproute2
命令 ip address delete
(或缩写ip a d
)允许删除协议地址(参见man ip address
)
问题ip a d
的使用相当不方便,需要的参数比充分指定其任务所需的参数多。真的吗?例子:
user@box$> ip a s
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
2: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 24:ee:9a:00:00:01 brd ff:ff:ff:ff:ff:ff
inet 10.192.0.174/24 brd 10.192.0.255 scope global dynamic noprefixroute wlo1
valid_lft 415283sec preferred_lft 415283sec
user@box$> ip a d 10.192.0.174
Not enough information: "dev" argument is required.
user@box$> ip a d 10.192.0.174 dev wlo1
Warning: Executing wildcard deletion to stay compatible with old scripts.
Explicitly specify the prefix length (172.22.52.254/32) to avoid this warning.
This special behaviour is likely to disappear in further releases,
fix your scripts!
举个例子,因为在大多数情况下,分配的 IP 地址只分配给单个网络设备,我真的想知道如何让它iproute2
一起行动并已经删除 IP 地址,而不是让我毫无意义地复制网络掩码和网络设备.
甚至认为我目前很难看到多个网络设备将被分配相同 IP 的用例,或者使用不同的子网掩码多次分配 IP 地址的情况(顺便说一下,这种情况肯定iproute2
不是愿意忽略),我敢肯定,即使这些情况确实发生iproute2
了,也可以得到帮助(意思是,仅在模棱两可的情况下)。
有没有人找到一种方法来ip a d
减少无意义的工作?
顺便说一句/奖金:有没有办法让ip a a [ipadress]
默认的网络掩码比/32
/更无意义255.255.255.255
(或者有这个选择的理由吗?)?
我正在尝试创建一个静态 NAT,但是当我运行命令时ip route add nat 172.31.19.02 via 10.0.2.2
,它给了我错误Error: Invalid scope.
,并且在指定全局范围时它给出了同样的错误。我正在尝试使用 iproute2页面复制无状态 NAT 上描述的内容。
我的网络设置由同一子网上的两个物理接口(ens5、ens6)和一个用于我的 tinc vpn (vpn) 的虚拟接口组成。可以从 tinc 接口访问地址 10.0.2.2。目标是将流量从 转发172.31.19.02
到10.0.2.2
。
据我从文档的IP 地址页面了解,global
应该是“在任何地方都有效”。这是不正确的吗?
的相关部分ip a
:
2: ens5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether [...]
inet 172.31.19.01/20 brd 172.31.31.255 scope global ens5
valid_lft forever preferred_lft forever
[...]
3: ens6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether [...]
inet 172.31.19.02/20 brd 172.31.31.255 scope global ens6
valid_lft forever preferred_lft forever
[...]
4: vpn: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
link/none
inet 10.0.2.1/24 scope global homeforward
valid_lft forever preferred_lft forever
[...]
我的路由表:
$ ip r
default via 172.31.16.1 dev ens5 proto static
10.0.2.0/24 dev homeforward proto kernel scope link src 10.0.2.1
172.31.16.0/20 dev ens6 proto kernel scope link src 172.31.19.02
172.31.16.0/20 dev ens5 proto kernel scope link src 172.31.19.01
$ ip r ls table 1000
default via 172.31.16.1 dev ens5 proto static
172.31.19.01 dev ens5 proto static scope link
$ ip r ls table 1001
default via 172.31.16.1 dev ens6 proto static
172.31.19.02 dev ens6 proto static scope link
当我运行 ip 来获取 ip 地址时,我得到了
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether 6c:88:14:ba:cb:cc brd ff:ff:ff:ff:ff:ff
这些都不是ipv4地址,但是ifconfig
确实显示了,
$ sudo /sbin/ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1102801 bytes 74417671 (70.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1102801 bytes 74417671 (70.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.7.7.57 netmask 255.255.252.0 broadcast 10.7.7.255
inet6 fe80::440:3794:6794:8b1b prefixlen 64 scopeid 0x20<link>
inet6 2620:0:28a2:4010:2:2:8c75:f8a1 prefixlen 128 scopeid 0x0<global>
ether 6c:88:14:ba:cb:cc txqueuelen 1000 (Ethernet)
RX packets 32743430 bytes 48351612590 (45.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14856403 bytes 1590947780 (1.4 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我怎样才能获得 ipv4 信息而不会落入我已弃用(且值得信赖)的范围内ifconfig
?