SoHo - Alias of loopback interface

We will need a non-127.0.0.1 alias address on the loopback interface for port forwarding. Here is shell script for this task /etc/rc.d/init.d/lo1network

  1. #! /bin/bash
  2. #
  3. # lo1network       Bring up interface lo:1
  4. #
  5. # chkconfig: 2345 11 89
  6. # description: Activates special loopback interface for nat
  7. #
  8. ### BEGIN INIT INFO
  9. # Provides: $lo1network
  10. ### END INIT INFO
  11.  
  12. . /etc/init.d/functions
  13.  
  14. LO1IFACE="lo:1"
  15. LO1ADDRESS="172.16.111.1"
  16. LO1NETMASK="255.255.255.0"
  17.  
  18. test -r /etc/sysconfig/lo1network && . /etc/sysconfig/lo1network
  19.  
  20. /sbin/ifconfig $LO1IFACE $LO1ADDRESS netmask $LO1NETMASK
  21.  
  22. exit 0

Make it run on system boot

chkconfig lo1network on
service lo1network start<