伊顿
伍德沃德大道10000号
伍德里奇,伊利诺斯州60517
+ (773) 869 - 1776
+1 (773) 869-1329
cpdipresaleshelp@eaton.com
美国
联系我们

为每个串口分配唯一的话务台服务器IP地址

如何为每个串口分配唯一的IP地址(固件V3.5. 0)。X及以后)

使用控制台服务器固件V3.5。以后,您可以使用GUI为每个串口分配唯一的IP地址。早期版本需要命令行脚本(请参阅Firmware Pre-V3.5部分)。

下面的示例在主网络接口上配置了四个IP地址,用于通过SSH进行串行访问。


  1. 点击系统知识产权网络接口
    • IP别名,用逗号分隔CIDR表示的串口IP地址列表(192.168.0.101/24,192.168.0.102/24,192.168.0.103/24,192.168.0.104/24)
    • 点击应用
  2. 点击系统防火墙端口/协议转发
    • 名称:串口1
    • 目的地址:192.168.0.101/24
    • 输入端口范围:22
    • 输出端口范围:3001
    • 点击保存
  3. 重复每个串口;替换名称、源地址和输出端口范围。

注意:下面是设置前两个端口的CLI命令:
配置\
-s config.interfaces.wan.alias='192.168.0.101/24, 192.168.0.102/24' \
- s config.firewall.portforwards.portforward1。in_interface =任何\
- s config.firewall.portforwards.portforward1。in_ports = 22 \
-s config.firewall.portforwards.portforward1.dst_ip=192.168.0.101 \
-s config.firewall.portforwards.portforward1.name='串口1' \
- s config.firewall.portforwards.portforward1。out_ports = 3001 \
- s config.firewall.portforwards.portforward1。协议= tcp \
- s config.firewall.portforwards.portforward2。in_interface =任何\
- s config.firewall.portforwards.portforward2。in_ports = 22 \
-s config.firewall.portforwards.portforward2.dst_ip=192.168.0.102 \
-s config.firewall.portforwards.portforward2.name='串口2' \
- s config.firewall.portforwards.portforward2。out_ports = 3002 \
- s config.firewall.portforwards.portforward2。协议= tcp \
- s config.firewall.portforwards.total = 2
配置-r ipconfig


如何为每个串口分配唯一IP地址(固件版本v3.5前)

对于v3.5之前的控制台服务器固件,您可以使用下面的脚本为每个串口分配唯一的IP地址。要执行脚本,创建一个名为filter-custom/etc/config.这将确保脚本不受防火墙规则和配置更改的影响。更新脚本中的IP和IPSTART值,以反映设备的IP和IP范围的起始值。重新启动设备执行脚本。

# !/bin/sh IPTABLES="/bin/iptables" MODEL=`config -g config.system.model | cut -f2 -d' '` if [ "$MODEL" = "IMG4216-25" ]; then OOB_IP=$(ifconfig eth1:0 2> /dev/null | grep inet\ addr | cut -f2 -d':' | cut -f1 -d' ') MGMT_IP=$(ifconfig eth1 2> /dev/null | grep inet\ addr | cut -f2 -d':' | cut -f1 -d' ') fi MGMTLAN_IN=MgmtLanInput MGMTLAN_OUT=MgmtLanOutput OOB_IN=OobInput OOB_OUT=OobOutput DYNADDR_IN=DynAddrInput DYNADDR_FORWARD=DynAddrForward export CASCADE=Cascade export CASCADENAT=CascadeNat export CASCADEMASQ=CascadeMasq # Script paths CUSTOMFILE=/etc/config/filter-custom CASCADEFILE=/etc/config/filter-cascade RULESFILE=/etc/config/fw.rules cat /etc/config/fw.rules | iptables-restore # Enable IP forwarding between network interfaces echo 1 > /proc/sys/net/ipv4/ip_forward if [ ! -z "${MGMT_IP}" ]; then ${IPTABLES} -A ${DYNADDR_IN} --destination ${MGMT_IP} -j ${MGMTLAN_IN} ${IPTABLES} -A ${DYNADDR_OUT} --source ${MGMT_IP} -j ${MGMTLAN_OUT} fi if [ ! -z "${OOB_IP}" ]; then ${IPTABLES} -A ${DYNADDR_IN} --destination ${OOB_IP} -j ${OOB_IN} ${IPTABLES} -A ${DYNADDR_OUT} --source ${OOB_IP} -j ${OOB_OUT} fi if [ -f ${CASCADEFILE} ]; then . ${CASCADEFILE} fi # # Set up IPv6 firewall # if [ -f /etc/rc.firewall6 ]; then /bin/sh /etc/rc.firewall6 fi IP=192.168.254 IPSTART=180 # Create the aliases export PORTS=`ls /var/dev/ | grep port | sed s/port// | awk '{ printf("%d\n", $0) }'` for port in $PORTS do ifconfig eth0:$port $IP.$(($port + $IPSTART)) netmask 255.255.255.0 up done # Redirect 22 on these aliases to the 300x for port in $PORTS do iptables --append PREROUTING --table nat --in-interface eth0 --protocol tcp --destination $IP.$(($port + $IPSTART)) \ --dport 22 --jump DNAT --to :$(($port + 3000)) done
">
比较
0
产品

需要帮助购买?
我们随时为您提供帮助,包括产品选择、尺寸、安装和产品定制。请致电+ (773) 869 - 1776或电子邮件cpdipresaleshelp@eaton.com