|
|
|
|
|
|
Assigning unique IP addresses for each serial port The following script will assign a unique IP address for each serial port. To execute the script, create a file called filter-custom under /etc/config. This will ensure the script remains unaffected by firewall rules and configuration changes. Update the IP and IPSTART values within the script to reflect the IP of the device and starting value of the IP range respectively. Reboot the device to execute the script. #!/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 Refer to faq 255 for more information on using scripts to customise your console server. |
|
Solutions Product Overview Solutions Overview How to Buy |
About Us Corporate In the Media Press Releases Contact Us |
Resources YouTube Videos Resource Library |
Support Technical Support Knowledge Base Cabling & Adapters Contact Us |
| © Opengear 2012 | Privacy Policy |