AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[sip](server)

Martin Hope
Sebastian Schmitt
Asked: 2021-06-19 02:20:44 +0800 CST

如何正确挂断 3CX 的 Freeswitch/Sofia SIP-Calls?

  • 1

我们在主机 A 上运行一个 FreeSwitch 实例,它使用 SOFIA 模块向在主机 B 上运行的 3CX 实例发出出站呼叫。

一切正常,除了挂断:主机 A 发送的 BYE 数据包未被 404 用户未知的 3CX 主机接受。

在第一次(工作)呼叫之后,由于线路被占用,直到我们重新启动整个 freeswitch-service 后,才能发起更多呼叫。

网关配置如下:

<include>
        <gateway name="default">

                <param name="realm" value="<host B>:5059"/>
                <param name="username" value="59"/>
                <param name="password" value="<the password>"/>
                <param name="register-transport" value="udp"/>
                <param name="extension" value="59"/>

                <param name="from-user" value="59"/>
                <param name="expire-seconds" value="800"/>
                <param name="register" value="true"/>
                <param name="register-transport" value="udp"/>
                <param name="context" value="public"/>
                <param name="caller-id-in-from" value="false“/>
                <param name="extension-in-contact" value="true"/>
                <param name="cid-type" value="rpid"/>
        </gateway>
</include>

该授权适用于除 BYE 之外的所有其他软件包。我们还打开了 SIP-tracing 并验证了 Proxy-Athorization 标头设置是否正确:

BYE sip:<destination number>@<host B>:5059 SIP/2.0
Via: SIP/2.0/UDP <host A>:5059;rport;branch=z9hG4bKpB6QZ9aU643pH
Max-Forwards: 70
From: "pi" <sip:59@<host B>:5059>;tag=jXU3S8avD9tQH
To: <sip:<dest number>@<host B>:5059>;tag=4442ed0d
Call-ID: fac6951d-4ab5-123a-0d9b-dca632517e68
CSeq: 37449519 BYE
User-Agent: FreeSWITCH-mod_sofia/1.10.6-release-7-1ff9d0a60e~32bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Proxy-Authorization: Digest username="59", realm="3CXPhoneSystem", nonce="414d535960cc5fda38:061e13fce3696c0ade88da4c548cab3a", algorithm=MD5, uri="sip:<dest number>@<host B>:5059", response="9d75bd5d59cc7b2111e005259d04aa65"
Reason: Q.850;cause=16;text="NORMAL_CLEARING"
Content-Length: 0

检查 3CX 端的 SIP 包,我们被告知根本不应该授权 BYE 包使其工作。

因此,我们将以下设置添加到正在使用的配置文件中:

<param name="auth-all-packets" value="false"/>

但 Sofia(或 Freeswitch?)仍然授权 BYE 包。

任何人都可以帮助我们吗?这会很棒!

fax voip sip freeswitch
  • 1 个回答
  • 149 Views
Martin Hope
Leonel Franchelli
Asked: 2021-05-26 12:46:09 +0800 CST

WebRTC潮流UCM6510

  • 0

有时 webrtc 传输连接已建立,但是当我在 chrome://webrtc-internals 中观察到该传输中的 dtls 会话时,它停留在“正在连接”中,并且来自主流的远程证书对等方永远不会到达,它会是什么?,我该如何调试它?

为客户端配置了转服务器,并且大流有一个专用的公共 ip

客户正在使用 sip.js 库

TURN 服务器已针对涓涓冰和其他几项测试进行了测试,并且运行良好

nat ip sip webrtc turn
  • 1 个回答
  • 58 Views
Martin Hope
pgr
Asked: 2021-05-14 03:40:20 +0800 CST

特定端口范围的路由流量

  • 0

我有一个 Ubiquiti Dream Machine (UDM),它是一个项目的一部分,该项目正在用不同的拓扑替换网络拓扑。这涉及 Internet 流量和 VoIP(Asterisk)。在分阶段引入新拓扑的过程中,由于我们在配置 Asterisk 服务器时的限制,我有以下要求:

10.0.0.1在 UDM 上,我需要将端口中指向的所有 UDP 流量重新路由50000-55000到10.0.10.1接口上br8

我怀疑这可以通过 UI 实现,但我可以通过 SSH 访问 UDM,我可以在其中修改iptables和ip route配置。

在UDM上,路由表是这样的:

# ip route
10.0.0.0/24 dev br3 proto kernel scope link src 10.0.0.1
10.0.1.0/24 dev br5 proto kernel scope link src 10.0.1.1
10.0.2.0/24 dev br6 proto kernel scope link src 10.0.2.1
10.0.3.0/24 dev br4 proto kernel scope link src 10.0.3.1
10.0.10.0/24 dev br8 proto kernel scope link src 10.0.10.1
10.1.1.0/24 dev br0 proto kernel scope link src 10.1.1.1
10.2.2.0/24 dev br2 proto kernel scope link src 10.2.2.1
192.168.1.0/24 dev eth4 proto kernel scope link src 192.168.1.86

关于拓扑的重要说明:10.0.10.0/24 网络是新旧拓扑之间的 VoIP 流量桥接,旧的 VoIP 服务器具有以下路由表:

# ip route
192.168.1.248/29 dev eth1  proto kernel  scope link  src 192.168.1.250
10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.1
10.0.1.0/24 dev eth3  proto kernel  scope link  src 10.0.1.1
10.0.10.0/24 dev eth2  proto kernel  scope link  src 10.0.10.10
10.0.0.0/8 via 10.0.10.1 dev eth2
default via 192.168.1.254 dev eth1

一些网络看起来有冲突,但它们并没有真正相互交谈。这两个服务器之间的唯一通信是br8连接到eth2旧服务器上的 UDM 上的 VLAN,仅用于 VoIP 流量。

路由正在按我的预期工作。VoIP 正在通过服务器10.0.10.10,从旧世界和新世界都可以看到。当我拨打 VoIP 电话时,SIP 协商正确进行,这意味着每部电话都能看到服务器并进行双向通话。

我唯一的问题是,当 RTP 语音流量开始流动时,有时其中一部电话(取决于发起呼叫的一方)将其发送到旧的 VoIP 服务器地址(原为 10.0.0.1)而不是新的 10.0。 10.10。尽管被重新配置为使用新地址,并且尽管刚刚与新地址进行了 SIP 协商,但仍会发生这种情况!这是一个星号配置问题,会在 SIP 邀请中发送错误的地址,从而欺骗电话。Asterisk 服务器认为这一切都是一样的,因为他自己的身份是 10.0.0.1 和 10.0.10.10,但这仅在旧世界中是正确的,在新世界中不是……

因此,在单向音频通话期间,我在 UDM 上看到了这种流量:

# tcpdump -q -n -c 20 -i any host 10.0.10.10 or host 10.0.2.1833 or host 10.0.10.47
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes
12:20:55.545461 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.545461 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.545461 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.565464 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.565464 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.565464 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.570260 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570260 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570313 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570317 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570764 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570764 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570807 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.570810 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.571077 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.571077 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.571109 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.571111 IP 10.0.2.183.50030 > 10.0.10.10.54736: UDP, length 172
12:20:55.585465 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172
12:20:55.585465 IP 10.0.10.47.5032 > 10.0.0.1.50042: UDP, length 172

去 10.0.10.10 的流量可以,去 10.0.0.1 的流量不行。我想重定向它,但我需要你的帮助。

(我知道可以,甚至应该通过某种方式修复 Asterisk 服务器配置来尝试解决方案,但是那里有限制,我只负责重新路由解决方案。询问重新路由是我的唯一目的这里的问题)。

UDM 上的当前iptables 配置是这样的:

# iptables-save
# Generated by iptables-save v1.6.1 on Thu May 13 12:28:34 2021
*nat
:PREROUTING ACCEPT [149794:35652606]
:INPUT ACCEPT [59043:3818189]
:OUTPUT ACCEPT [205240:13204474]
:POSTROUTING ACCEPT [179113:10974505]
:UBIOS_INPUT_JUMP - [0:0]
:UBIOS_OUTPUT_JUMP - [0:0]
:UBIOS_POSTROUTING_JUMP - [0:0]
:UBIOS_POSTROUTING_USER_HOOK - [0:0]
:UBIOS_PREROUTING_JUMP - [0:0]
-A PREROUTING -j UBIOS_PREROUTING_JUMP
-A INPUT -j UBIOS_INPUT_JUMP
-A OUTPUT -j UBIOS_OUTPUT_JUMP
-A POSTROUTING -j UBIOS_POSTROUTING_JUMP
-A UBIOS_POSTROUTING_JUMP -j UBIOS_POSTROUTING_USER_HOOK
-A UBIOS_POSTROUTING_USER_HOOK -o eth4 -m comment --comment 00000001095216660481 -j MASQUERADE
COMMIT
# Completed on Thu May 13 12:28:34 2021
# Generated by iptables-save v1.6.1 on Thu May 13 12:28:34 2021
*mangle
:PREROUTING ACCEPT [21051971:19450922056]
:INPUT ACCEPT [11815594:10852127372]
:FORWARD ACCEPT [9222781:8597163389]
:OUTPUT ACCEPT [11762182:10802741148]
:POSTROUTING ACCEPT [21125153:19406413016]
COMMIT
# Completed on Thu May 13 12:28:34 2021
# Generated by iptables-save v1.6.1 on Thu May 13 12:28:34 2021
*filter
:INPUT ACCEPT [11703464:10819984868]
:FORWARD ACCEPT [9222781:8597163389]
:OUTPUT ACCEPT [11762124:10802734194]
:UBIOS_FORWARD_IN_USER - [0:0]
:UBIOS_FORWARD_JUMP - [0:0]
:UBIOS_FORWARD_OUT_USER - [0:0]
:UBIOS_FORWARD_USER_HOOK - [0:0]
:UBIOS_INPUT_JUMP - [0:0]
:UBIOS_INPUT_USER_HOOK - [0:0]
:UBIOS_IN_GEOIP - [0:0]
:UBIOS_LAN_IN_USER - [0:0]
:UBIOS_LAN_LOCAL_USER - [0:0]
:UBIOS_LAN_OUT_USER - [0:0]
:UBIOS_OUTPUT_JUMP - [0:0]
:UBIOS_OUTPUT_USER_HOOK - [0:0]
:UBIOS_OUT_GEOIP - [0:0]
:UBIOS_WAN_IN_USER - [0:0]
:UBIOS_WAN_LOCAL_USER - [0:0]
:UBIOS_WAN_OUT_USER - [0:0]
-A INPUT -j UBIOS_INPUT_JUMP
-A FORWARD -j UBIOS_FORWARD_JUMP
-A OUTPUT -j UBIOS_OUTPUT_JUMP
-A UBIOS_FORWARD_IN_USER -i eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_JUMP -j UBIOS_FORWARD_USER_HOOK
-A UBIOS_FORWARD_OUT_USER -o eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_USER_HOOK -m comment --comment 00000001095216663481 -j UBIOS_FORWARD_IN_USER
-A UBIOS_FORWARD_USER_HOOK -m comment --comment 00000001095216663482 -j UBIOS_FORWARD_OUT_USER
-A UBIOS_INPUT_JUMP -j UBIOS_INPUT_USER_HOOK
-A UBIOS_INPUT_USER_HOOK -i eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_LAN_IN_USER -d 10.0.10.10/32 -j LOG
-A UBIOS_LAN_IN_USER -d 10.0.10.10/32 -m comment --comment 00000001095216662480 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.10.10/32 -j LOG
-A UBIOS_LAN_IN_USER -s 10.0.10.10/32 -m comment --comment 00000001095216662481 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.2.0/24 -m comment --comment 00000001095216666481 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.3.0/24 -m comment --comment 00000001095216666482 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.1.0/24 -m comment --comment 00000001095216666483 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.2.2.0/24 -m comment --comment 00000001095216666484 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.10.0/24 -m comment --comment 00000001095216666485 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.1.1.0/24 -m comment --comment 00000001095216666486 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.0.0/24 -m comment --comment 00000001095216666487 -j RETURN
-A UBIOS_LAN_IN_USER -j LOG
-A UBIOS_LAN_IN_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_LAN_LOCAL_USER -j LOG
-A UBIOS_LAN_LOCAL_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.2.0/24 -m comment --comment 00000001095216666481 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.3.0/24 -m comment --comment 00000001095216666482 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.1.0/24 -m comment --comment 00000001095216666483 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.2.2.0/24 -m comment --comment 00000001095216666484 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.10.0/24 -m comment --comment 00000001095216666485 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.1.1.0/24 -m comment --comment 00000001095216666486 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.0.0/24 -m comment --comment 00000001095216666487 -j RETURN
-A UBIOS_LAN_OUT_USER -j LOG
-A UBIOS_LAN_OUT_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_WAN_IN_USER -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment 00000001095216663481 -j RETURN
-A UBIOS_WAN_IN_USER -m conntrack --ctstate INVALID -m comment --comment 00000001095216663482 -j DROP
-A UBIOS_WAN_IN_USER -m comment --comment 00000001097364144127 -j DROP
-A UBIOS_WAN_LOCAL_USER -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment 00000001095216663481 -j RETURN
-A UBIOS_WAN_LOCAL_USER -m conntrack --ctstate INVALID -m comment --comment 00000001095216663482 -j DROP
-A UBIOS_WAN_LOCAL_USER -m comment --comment 00000001097364144127 -j DROP
-A UBIOS_WAN_OUT_USER -m comment --comment 00000001097364144127 -j RETURN
COMMIT

我在网上阅读了关于按照以下方式做我想做的事情的可能性:

  • 标记要在 iptables 中路由的数据包(使用 mangle)
  • 为这些数据包使用第二个路由表(添加到 /etc/iproute2/rt_tables)
  • 调整该表以将东西发送到需要去的地方

虽然我了解一般概念,但我不是网络专家,我对这些概念不熟悉,我迷失在细节中。我不确定如何标记,以及在第二个表中需要重复多少主路由表。对于这些命令和配置,我将不胜感激。提前致谢!

那么,如何将 UDM 上指向的所有 UDP 流量10.0.0.1在端口中重新路由50000-55000到接口上的 10.0.10.1br8?

routing iptables sip
  • 2 个回答
  • 624 Views
Martin Hope
pgr
Asked: 2021-05-08 06:10:55 +0800 CST

VoIP 单向音频,仅当从一侧发起呼叫时

  • 1

我正在设置一些新的交换机和 VLAN,但我在使用我们预先存在的 Asterisk VoIP 设置时遇到了麻烦。

大多数电话工作正常。有些只是单向音频。我试图将其缩小到这个特定的测试情况:

Asterisk 服务器是 10.0.10.10。

调用正常:

如果电话 10.0.2.183 呼叫 10.0.10.47 上的电话,则音频双向流动良好。此 Wireshark 图中描述了此工作调用: 捕获双向有效的呼叫

仅获得单向音频的呼叫:

如果相反,我交换情况并从另一部电话启动,即电话 10.0.10.47 呼叫 10.0.2.183 上的电话,音频仅单向流动:10.0.2.183 听不到 10.0.10.47。此 Wireshark 图中描述了此错误调用:

在此处输入图像描述

NAT?

我在网上看到很多东西表明单向音频的典型原因是 NAT。我不认为我正在使用 NAT。我该如何检查?这都是我局域网内部的。

防火墙?

我花了很多时间修补 10.0.10.10 上的iptables防火墙,打开所有东西(即使只是暂时的,作为测试)。我不明白它是如何阻止这一特定流量的,同时又让这么多流量通过。但我谦虚地认为iptables是我无法完全驯服的野兽。这里有什么想法吗?

路由?

我还怀疑可能存在路由问题,因为我正在移动服务器并将 VLAN 彼此隔离(VoIP VLAN 除外,它是 10.0.10.*,并且应该可供所有其他 VLAN 访问)。我不得不使用 10.0.10.10 上的路由表来让一些流量按照我想要的方式进行:

:/home1/_locals/operator# ip route
(1) 192.168.1.248/29 dev eth1  proto kernel  scope link  src 192.168.1.250
(2) 10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.1
(3) 10.0.1.0/24 dev eth3  proto kernel  scope link  src 10.0.1.1
(4) 10.0.10.0/24 dev eth2  proto kernel  scope link  src 10.0.10.10
(5) 10.0.0.0/8 via 10.0.10.1 dev eth2
(6) default via 192.168.1.254 dev eth1

我已经对规则进行了编号,因此您可以根据需要对其进行评论。

有关如何解决此问题的任何想法?为什么除了一些非常特定的 RTP 流量之外,一切都在进行?提前感谢您的帮助。

额外要求的信息

10.0.10.0/24 网络中的 DHCP 配置:

在此处输入图像描述

这应该在电话上提供直接的路由表,只有 10.0.10.10 具有静态 IP 和上面提供的更改后的路由表。

简化的网络拓扑:

简化的网络拓扑

实际上,这更时髦,我在两种拓扑之间移动的一半。例如,我有两个 10.0.0.0 子网。但据说它们是分开的。我的问题可能源于这种时髦,但我需要准确指出缺少哪些配置才能使其正常工作。

10.0.10.1 上的路由表,即 Ubiquiti UDM

# ip route
10.0.0.0/24 dev br3 proto kernel scope link src 10.0.0.1
10.0.1.0/24 dev br5 proto kernel scope link src 10.0.1.1
10.0.2.0/24 dev br6 proto kernel scope link src 10.0.2.1
10.0.3.0/24 dev br4 proto kernel scope link src 10.0.3.1
10.0.10.0/24 dev br8 proto kernel scope link src 10.0.10.1
10.1.1.0/24 dev br0 proto kernel scope link src 10.1.1.1
10.2.2.0/24 dev br2 proto kernel scope link src 10.2.2.1
192.168.1.0/24 dev eth4 proto kernel scope link src 192.168.1.86

同一主机上的防火墙:

# iptables-save
# Generated by iptables-save v1.6.1 on Fri May  7 22:04:20 2021
*nat
:PREROUTING ACCEPT [30400:5954281]
:INPUT ACCEPT [9407:875595]
:OUTPUT ACCEPT [31671:2057109]
:POSTROUTING ACCEPT [25363:1582041]
:UBIOS_INPUT_JUMP - [0:0]
:UBIOS_OUTPUT_JUMP - [0:0]
:UBIOS_POSTROUTING_JUMP - [0:0]
:UBIOS_POSTROUTING_USER_HOOK - [0:0]
:UBIOS_PREROUTING_JUMP - [0:0]
-A PREROUTING -j LOG --log-prefix "::PREROUTING:"
-A PREROUTING -j UBIOS_PREROUTING_JUMP
-A INPUT -j LOG --log-prefix "::INPUT:"
-A INPUT -j UBIOS_INPUT_JUMP
-A OUTPUT -j LOG --log-prefix "::OUTPUT:"
-A OUTPUT -j UBIOS_OUTPUT_JUMP
-A POSTROUTING -j LOG --log-prefix "::POSTROUTING:"
-A POSTROUTING -j UBIOS_POSTROUTING_JUMP
-A UBIOS_POSTROUTING_JUMP -j UBIOS_POSTROUTING_USER_HOOK
-A UBIOS_POSTROUTING_USER_HOOK -o eth4 -m comment --comment 00000001095216660481 -j MASQUERADE
COMMIT
# Completed on Fri May  7 22:04:20 2021
# Generated by iptables-save v1.6.1 on Fri May  7 22:04:20 2021
*mangle
:PREROUTING ACCEPT [5740653266:1557524250007]
:INPUT ACCEPT [5729417629:1548285462113]
:FORWARD ACCEPT [11076849:9225341544]
:OUTPUT ACCEPT [5729656413:1548109771107]
:POSTROUTING ACCEPT [5741373562:1557359586630]
:UBIOS_FORWARD_JUMP - [0:0]
:UBIOS_FORWARD_TCPMSS - [0:0]
:UBIOS_FORWARD_USER_HOOK - [0:0]
:UBIOS_INPUT_JUMP - [0:0]
:UBIOS_INPUT_USER_HOOK - [0:0]
:UBIOS_OUTPUT_JUMP - [0:0]
:UBIOS_OUTPUT_USER_HOOK - [0:0]
:UBIOS_POSTROUTING_JUMP - [0:0]
:UBIOS_POSTROUTING_SHAPER - [0:0]
:UBIOS_POSTROUTING_USER_HOOK - [0:0]
:UBIOS_PREROUTING_JUMP - [0:0]
:UBIOS_PREROUTING_USER_HOOK - [0:0]
-A PREROUTING -j UBIOS_PREROUTING_JUMP
-A INPUT -j UBIOS_INPUT_JUMP
-A FORWARD -j UBIOS_FORWARD_JUMP
-A OUTPUT -j UBIOS_OUTPUT_JUMP
-A POSTROUTING -j UBIOS_POSTROUTING_JUMP
-A UBIOS_FORWARD_JUMP -j UBIOS_FORWARD_TCPMSS
-A UBIOS_POSTROUTING_JUMP -j UBIOS_POSTROUTING_SHAPER
COMMIT
# Completed on Fri May  7 22:04:20 2021
# Generated by iptables-save v1.6.1 on Fri May  7 22:04:20 2021
*filter
:INPUT ACCEPT [3169950958:856215960609]
:FORWARD ACCEPT [4175578:2973708433]
:OUTPUT ACCEPT [3170232928:856108555985]
:UBIOS_FORWARD_IN_USER - [0:0]
:UBIOS_FORWARD_JUMP - [0:0]
:UBIOS_FORWARD_OUT_USER - [0:0]
:UBIOS_FORWARD_USER_HOOK - [0:0]
:UBIOS_INPUT_JUMP - [0:0]
:UBIOS_INPUT_USER_HOOK - [0:0]
:UBIOS_IN_GEOIP - [0:0]
:UBIOS_LAN_IN_USER - [0:0]
:UBIOS_LAN_LOCAL_USER - [0:0]
:UBIOS_LAN_OUT_USER - [0:0]
:UBIOS_OUTPUT_JUMP - [0:0]
:UBIOS_OUTPUT_USER_HOOK - [0:0]
:UBIOS_OUT_GEOIP - [0:0]
:UBIOS_WAN_IN_USER - [0:0]
:UBIOS_WAN_LOCAL_USER - [0:0]
:UBIOS_WAN_OUT_USER - [0:0]
-A INPUT -j LOG --log-prefix "::INPUT1:"
-A INPUT -j UBIOS_INPUT_JUMP
-A FORWARD -j LOG --log-prefix "::INPUT2:"
-A FORWARD -j UBIOS_FORWARD_JUMP
-A OUTPUT -j LOG --log-prefix "::INPUT3:"
-A OUTPUT -j UBIOS_OUTPUT_JUMP
-A UBIOS_FORWARD_IN_USER -i eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_IN_USER -i br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_IN_USER
-A UBIOS_FORWARD_JUMP -j UBIOS_FORWARD_USER_HOOK
-A UBIOS_FORWARD_OUT_USER -o eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_OUT_USER -o br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_OUT_USER
-A UBIOS_FORWARD_USER_HOOK -m comment --comment 00000001095216663481 -j UBIOS_FORWARD_IN_USER
-A UBIOS_FORWARD_USER_HOOK -m comment --comment 00000001095216663482 -j UBIOS_FORWARD_OUT_USER
-A UBIOS_INPUT_JUMP -j UBIOS_INPUT_USER_HOOK
-A UBIOS_INPUT_USER_HOOK -i eth4 -m comment --comment 00000001095216663481 -j UBIOS_WAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br0 -m comment --comment 00000001095216663482 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br2 -m comment --comment 00000001095216663483 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br3 -m comment --comment 00000001095216663484 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br4 -m comment --comment 00000001095216663485 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br5 -m comment --comment 00000001095216663486 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br6 -m comment --comment 00000001095216663487 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_INPUT_USER_HOOK -i br8 -m comment --comment 00000001095216663488 -j UBIOS_LAN_LOCAL_USER
-A UBIOS_LAN_IN_USER -d 10.0.10.10/32 -j LOG
-A UBIOS_LAN_IN_USER -d 10.0.10.10/32 -m comment --comment 00000001095216662480 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.10.10/32 -j LOG
-A UBIOS_LAN_IN_USER -s 10.0.10.10/32 -m comment --comment 00000001095216662481 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.2.0/24 -m comment --comment 00000001095216666481 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.3.0/24 -m comment --comment 00000001095216666482 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.1.0/24 -m comment --comment 00000001095216666483 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.2.2.0/24 -m comment --comment 00000001095216666484 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.10.0/24 -m comment --comment 00000001095216666485 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.1.1.0/24 -m comment --comment 00000001095216666486 -j RETURN
-A UBIOS_LAN_IN_USER -s 10.0.0.0/24 -m comment --comment 00000001095216666487 -j RETURN
-A UBIOS_LAN_IN_USER -j LOG
-A UBIOS_LAN_IN_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_LAN_LOCAL_USER -j LOG
-A UBIOS_LAN_LOCAL_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.2.0/24 -m comment --comment 00000001095216666481 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.3.0/24 -m comment --comment 00000001095216666482 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.1.0/24 -m comment --comment 00000001095216666483 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.2.2.0/24 -m comment --comment 00000001095216666484 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.10.0/24 -m comment --comment 00000001095216666485 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.1.1.0/24 -m comment --comment 00000001095216666486 -j RETURN
-A UBIOS_LAN_OUT_USER -d 10.0.0.0/24 -m comment --comment 00000001095216666487 -j RETURN
-A UBIOS_LAN_OUT_USER -j LOG
-A UBIOS_LAN_OUT_USER -m comment --comment 00000001097364144127 -j RETURN
-A UBIOS_WAN_IN_USER -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment 00000001095216663481 -j RETURN
-A UBIOS_WAN_IN_USER -m conntrack --ctstate INVALID -m comment --comment 00000001095216663482 -j DROP
-A UBIOS_WAN_IN_USER -m comment --comment 00000001097364144127 -j DROP
-A UBIOS_WAN_LOCAL_USER -m conntrack --ctstate RELATED,ESTABLISHED -m comment --comment 00000001095216663481 -j RETURN
-A UBIOS_WAN_LOCAL_USER -m conntrack --ctstate INVALID -m comment --comment 00000001095216663482 -j DROP
-A UBIOS_WAN_LOCAL_USER -m comment --comment 00000001097364144127 -j DROP
-A UBIOS_WAN_OUT_USER -m comment --comment 00000001097364144127 -j RETURN
COMMIT

我没有配置任何端口转发。我不精通 NAT,所以如果还有其他地方我应该检查,请在评论中提出建议。

routing iptables asterisk wireshark sip
  • 1 个回答
  • 271 Views
Martin Hope
Victor Sanchez
Asked: 2020-05-13 11:01:54 +0800 CST

将 siproxd 配置为在 openvpn 连接后面使用

  • 1

我需要配置一个代理 sip。我发现了 siproxd,但我无法使用它。

我的网络如下:

PC-Windows -> Use MicroSip -> 192.168.1.10 
PC-Linux -> Use siproxd -> 
   Network interface -> ens33 -> 192.168.1.111  
   Network interface -> tun0 ->  10.10.2.33 (OpenVPN raised) 
PC-Asterisk -> 10.10.2.222

我将此配置文件用于 siproxd(其他默认选项)

if_inbound  = ens33
if_outbound = tun0
host_outbound = 10.10.2.222

在 microsip 中,我配置 Proxy 字段并输入:192.168.1.111。其他字段与我直接访问 PC-Asterisk (10.10.2.222) 时相同(或者当我可以在这台机器上使用 openvpn 时)

Microsip 连接正确,但不允许我拨打电话。

我究竟做错了什么?还有另一种简单的替代方法吗?

proxy sip
  • 1 个回答
  • 229 Views
Martin Hope
Mattisdada
Asked: 2020-04-03 14:57:10 +0800 CST

星号:在 h 扩展中使用 Queue()

  • 0

我试图让用户能够录制消息、挂断电话、继续通话、拨打队列并播放录音。

我已经完成了大部分工作,但是现在当我拨打Queue()h 分机时,它会立即挂断(队列成员确实接到了大约 1 毫秒的电话)。虽然我正在使用选项c

我的拨号方案(为简洁起见)

[standard-gn-helpdesk-corona-afterhours]
; Hangup Extension
exten => h,1, NoOp(hangup standard-gn-helpdesk-corona-afterhours)
same => n, Gosub(sub-queue-gn-afterhours,s,1)
same => n, Return()

exten => s,1, NoOp(standard-gn-helpdesk-corona-afterhours)
same => n, Record(gn_ah_recording%d:ulaw)
same => n, Hangup()
; Callee has hungup by this point. `h` should be executed

[playback-recorded-message]
exten => s,1, NoOp(playback-recorded-message)
same => n, Playback(${RECORDED_FILE})

[sub-queue-gn-afterhours]
exten => s,1,NoOp(sub-queue-gn-afterhours)
; Has the `c` option which allows the queue to continue when callee hangs
same => n,Queue(GNAfterHours1,tkc,,,540,,,playback-recorded-message)
same => n,Return()

任何的意见都将会有帮助。我会被迫使用Dial()该F选项吗?

asterisk voip sip queue
  • 1 个回答
  • 1018 Views
Martin Hope
Tony Bucci
Asked: 2018-09-11 06:05:33 +0800 CST

Grandstream GXP2170 XML 配置用于 7 位拨号计划

  • 0

我需要能够在固件“Prog 1.0.9.69”上配置一个拨号计划,该计划可以将区号添加到 Grandstream GXP2170(配置文件在 GXP21XX 型号之间非常相似)上拨打的 7 位数号码,配置必须由配置文件完成。Grandstream 支持表示它对他们有用并且对我不屑一顾,即使在试图确认他们理解我的需求之后,如果这个功能不存在,那么我只需要确认它不存在。我们通过 HTTPS 提供的 XML 文件进行配置,我检查了我的服务器 access.log 并且可以看到文件被成功提取,但是手机没有处理它并应用它(如果我删除了“<=1941>[2-9 ]xxxxxx" 从拨号计划中下载并立即处理)其他人可以确认吗?我还可以通过 Web GUI 编写一个有效的拨号计划,但需要能够使用配置文件提供此功能。此外,管理员指南说“注意:配置文件(.xml 和 .txt)不支持此功能。” 但不清楚他们所说的功能是什么,在我看来,GUI 可以做一些配置文件不能做的事情,这似乎很愚蠢和倒退。

sip
  • 1 个回答
  • 220 Views
Martin Hope
Dominic P
Asked: 2016-10-22 15:30:48 +0800 CST

让 PJSIP 与 TLS 一起使用 FreePBX 上的 Twilio SIP Trunking

  • 2

我想知道是否有人可以帮助我调试我遇到的这个问题。我正在尝试使用 PJSIP 堆栈在我的 FreePBX 服务器和 Twilio 之间进行安全中继设置。

未加密的中继在 UDP 上运行良好。但是,当我尝试启用 TLS/SRTP 时,我似乎无法让它工作。一旦我将主干更新为使用 5061 和 TLS 传输,我就会在 Asterisk 日志中得到以下信息。

WARNING[5268] pjproject: tsx0x27c4cd8 .Failed to send Request msg OPTIONS/cseq=28056 (tdta0x26d3af0)! err=171064 (Unsuitable transport selected (PJSIP_ETPNOTSUITABLE))
ERROR[5268] res_pjsip.c: Error 171064 'Unsuitable transport selected (PJSIP_ETPNOTSUITABLE)' sending OPTIONS request to endpoint Twilio

我认为问题可能是 PJSIP 不支持通配符 SSL 证书,而 Twilio 使用的是通配符,但我不确定如何确定。关于如何调试它的任何想法都会非常有帮助。

更新:我直接在星号配置文件中调整了一些 URI,现在我已经克服了不合适的传输错误。新的错误正如我所担心的那样:

ERROR[524] pjproject: RFC 5922 (section 7.2) does not allow TLS wildcard certificates. Advise your SIP provider, please!

关于如何解决这个问题的任何想法?

sip freepbx tls
  • 1 个回答
  • 2255 Views
Martin Hope
markhorrocks
Asked: 2016-10-21 06:38:14 +0800 CST

为闪烁和 linphone 配置星号

  • 0

我在 Ubuntu 14.04 上设置了一个 Asterisk 服务器(14.0.2)。我可以使用 ulaw 和 Zoiper(没有 STUN 或 ICE)从 Twilio 获得声音。在每种情况下,星号服务器都会播放 gsm 文件。

我无法从 Linphone 或 Blink 软件电话中获得任何声音,尽管两者都注册良好。这些安装在 Ubuntu 16.04 笔记本电脑 (Dell Inspiron-13-7359) 上。我已经启用了手机上所有可用的编解码器,并为我的笔记本电脑尝试了所有可用的音频设备设置。任何帮助,将不胜感激。

这是我的 Asterisk PJSIP 配置。

[transport-udp-nat]
type = transport
protocol = udp
bind = 0.0.0.0
; NAT settings
local_net = 10.0.0.0/8
external_media_address = 12.345.67.254
external_signaling_address = 12.345.67.254
[endpoint-internal](!)
type = endpoint
transport = transport-udp-nat
context = Local
disallow=all
allow=ulaw
allow=alaw
allow=slin
allow=g729
allow=g722
allow=opus
allow=gsm
direct_media = no
trust_id_outbound = yes
device_state_busy_at = 1
dtmf_mode = rfc4733

这是星号中的核心显示编解码器(已编辑)

       3 audio alaw         alaw             (G.711 a-law)
      19 audio speex        speex            (SpeeX)
      20 audio speex        speex16          (SpeeX 16khz)
      21 audio speex        speex32          (SpeeX 32khz)
      23 audio g722         g722             (G722)
      18 audio g729         g729             (G.729A)
       8 audio slin         slin             (16 bit Signed Linear PCM)
       9 audio slin         slin12           (16 bit Signed Linear PCM (12kHz))
      10 audio slin         slin16           (16 bit Signed Linear PCM (16kHz))
      11 audio slin         slin24           (16 bit Signed Linear PCM (24kHz))
      12 audio slin         slin32           (16 bit Signed Linear PCM (32kHz))
      13 audio slin         slin44           (16 bit Signed Linear PCM (44kHz))
      14 audio slin         slin48           (16 bit Signed Linear PCM (48kHz))
      15 audio slin         slin96           (16 bit Signed Linear PCM (96kHz))
      16 audio slin         slin192          (16 bit Signed Linear PCM (192kHz))
       2 audio ulaw         ulaw             (G.711 u-law)
       4 audio gsm          gsm              (GSM)
redundancy)
  28 audio opus         opus             (Opus Codec)
ubuntu asterisk sip codecs
  • 1 个回答
  • 1185 Views
Martin Hope
Toaster
Asked: 2016-10-01 15:22:48 +0800 CST

在 Ubuntu 上为两个外部 IP 配置双接口

  • 0

我正在尝试为我们的 SIP 电话将第二个 ISP 连接连接到我的服务器。

eth0在192.168.1.x上有我们默认的 25Mb 服务,我已经配置了

eth1新的 6Mb 服务为10.10.1.x

两台路由器都配置了具有唯一静态 IP 的 pppoe,我有单独的交换机,以及一台带有两个以太网端口的 Ubuntu 14Lts 服务器。单独连接的任何一个都可以正常工作,但是两者都可以,我只能ping -I eth[0|1] 8.8.8.8 -c 3在一个接口上但是ping每个路由器没有问题。

如果有人可以帮助我让 Nic 启动并运行并默认主要流量通过eth0和 Just Asterisk/Sip 流量通过eth1将节省我的一天。

一些信息输出:

# cat /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.100
gateway 192.168.1.1
netmask 255.255.255.0

auto eth1
iface eth1 inet static
address 10.10.1.101
#gateway 10.10.1.1
netmask 255.255.255.0

$ sudo route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         home.Home       0.0.0.0         UG    0      0        0 eth1
10.10.1.0       *               255.255.255.0   U     1      0        0 eth1
link-local      *               255.255.0.0     U     1000   0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0

$ sudo ifdown eth0 && sudo ifup eth0

RTNETLINK answers: No such process
RTNETLINK answers: File exists
Failed to bring up eth0.

$ sudo ifdown eth1 && sudo ifup eth1

ifdown: interface eth1 not configured
RTNETLINK answers: File exists
Failed to bring up eth1.

$ ifconfig

eth0      Link encap:Ethernet  HWaddr 00:25:90:11:c8:44  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::225:90ff:fe11:c844/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2316517 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3877952 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1881181270 (1.8 GB)  TX bytes:5573716194 (5.5 GB)
          Interrupt:16 Memory:faee0000-faf00000 

eth1      Link encap:Ethernet  HWaddr 00:25:90:11:c8:45  
          inet addr:10.10.1.101  Bcast:10.10.1.255  Mask:255.255.255.0
          inet6 addr: fe80::225:90ff:fe11:c845/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:214622 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9763 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:13988405 (13.9 MB)  TX bytes:890576 (890.5 KB)
          Interrupt:16 Memory:fafe0000-fb000000 

======================编辑1: ========================= ==

感谢 Peter Zhabin 的 iproute2 说明

apt-get install iproute2
echo "1 link2" >> /etc/iproute2/rt_tables
ip route add 10.10.1.0/24 dev eth1 src 10.10.1.101 table link2
ip route add default via 10.10.1.1 dev eth1 table link2
ip rule add from 10.10.1.101/32 table link2
ip rule add to 10.10.1.101/32 table link2

我第一次尝试时有点奇怪sudo echo "1 link2" >> /etc/iproute2/rt_tables-bash: /etc/iproute2/rt_tables: Permission denied 但我切换到 Root 以避免需要 sudo 并且没有进一步的投诉。

======================编辑2: ========================= ==

# ping -I 10.10.1.101 8.8.8.8 -c 3

PING 8.8.8.8 (8.8.8.8) from 10.10.1.101 : 56(84) bytes of data.

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2014ms

======================编辑3: ======================== ==

# ip rule show

0:      from all lookup local 
32764:  from all to 10.10.1.101 lookup link2 
32765:  from 10.10.1.101 lookup link2 
32766:  from all lookup main 
32767:  from all lookup default 

# ip route show

default via 192.168.1.1 dev eth0 
10.10.1.0/24 dev eth1  proto kernel  scope link  src 10.10.1.101 
169.254.0.0/16 dev eth1  scope link  metric 1000 
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.100 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 

# ip route show table link2

default via 10.10.1.1 dev eth1 
10.10.1.0/24 dev eth1  scope link  src 10.10.1.101 

显示link2 表奇怪的是有点碰巧。我不明白为什么它并不总是打印。好消息是通过 IP 进行 Ping 工作,尽管 eth1 没有。为了完成,我还包括完整的展示表

# ip route show table all

default via 10.10.1.1 dev eth1  table link2 
10.10.1.0/24 dev eth1  table link2  scope link  src 10.10.1.101 
default via 192.168.1.1 dev eth0 
10.10.1.0/24 dev eth1  proto kernel  scope link  src 10.10.1.101 
169.254.0.0/16 dev eth1  scope link  metric 1000 
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.100 
192.168.122.0/24 dev virbr0  proto kernel  scope link  src 192.168.122.1 
broadcast 10.10.1.0 dev eth1  table local  proto kernel  scope link  src 10.10.1.101 
local 10.10.1.101 dev eth1  table local  proto kernel  scope host  src 10.10.1.101 
broadcast 10.10.1.255 dev eth1  table local  proto kernel  scope link  src 10.10.1.101 
broadcast 127.0.0.0 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
local 127.0.0.0/8 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
local 127.0.0.1 dev lo  table local  proto kernel  scope host  src 127.0.0.1 
broadcast 127.255.255.255 dev lo  table local  proto kernel  scope link  src 127.0.0.1 
broadcast 192.168.1.0 dev eth0  table local  proto kernel  scope link  src 192.168.1.100 
local 192.168.1.100 dev eth0  table local  proto kernel  scope host  src 192.168.1.100 
broadcast 192.168.1.255 dev eth0  table local  proto kernel  scope link  src 192.168.1.100 
broadcast 192.168.122.0 dev virbr0  table local  proto kernel  scope link  src 192.168.122.1 
local 192.168.122.1 dev virbr0  table local  proto kernel  scope host  src 192.168.122.1 
broadcast 192.168.122.255 dev virbr0  table local  proto kernel  scope link  src 192.168.122.1 
fe80::/64 dev eth0  proto kernel  metric 256 
fe80::/64 dev eth1  proto kernel  metric 256 
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101
local ::1 dev lo  table local  proto none  metric 0 
local fe80::225:90ff:fe11:c844 dev lo  table local  proto none  metric 0 
local fe80::225:90ff:fe11:c845 dev lo  table local  proto none  metric 0 
ff00::/8 dev eth0  table local  metric 256 
ff00::/8 dev eth1  table local  metric 256 
unreachable default dev lo  table unspec  proto kernel  metric 4294967295  error -101

# ping -I eth1 8.8.8.8 -c 3

PING 8.8.8.8 (8.8.8.8) from 10.10.1.101 eth1: 56(84) bytes of data.
From 10.10.1.101 icmp_seq=1 Destination Host Unreachable
From 10.10.1.101 icmp_seq=2 Destination Host Unreachable
From 10.10.1.101 icmp_seq=3 Destination Host Unreachable

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2015ms
pipe 3

# ping -I 10.10.1.101 8.8.8.8 -c 3

PING 8.8.8.8 (8.8.8.8) from 10.10.1.101 : 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=60 time=29.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=60 time=29.3 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=60 time=28.8 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 28.804/29.192/29.433/0.310 ms
ubuntu ethernet sip
  • 1 个回答
  • 3384 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve