Ip Aliasing Howto En

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Ip Aliasing Howto En as PDF for free.

More details

  • Words: 2,294
  • Pages: 24
IP Aliasing HowTo version 1

Gianluca Sironi

( save paper! use double-sided )

Table of Contents 1 2 3 4 5 6 7 8 9

Introduction........................................................................................................................................3 FDL (Free Documentation License)..................................................................................................4 Configure IP alias...............................................................................................................................5 UNIX: AIX..........................................................................................................................................6 UNIX: Solaris....................................................................................................................................10 UNIX: HP-UX...................................................................................................................................13 Linux..................................................................................................................................................15 Windows............................................................................................................................................19 References.........................................................................................................................................22

IP Aliasing HowTo - Gianluca Sironi

1

( save paper! use double-sided )

2

IP Aliasing HowTo di Gianluca Sironi

1 Introduction

1

Introduction

Aim of this document is to show how to configure IP alias (logical interfaces) on various Operating Systems. In this document we deal mainly with UNIX Operating Systems (AIX, Solaris, HP-UX) and Linux;.we give also information how to configure IP alias with Microsoft Windows. The goal is to show which are the configuration files and the commands related to IP aliasing. Some notes about the differences between the variuos UNIX flavours and Linux are shown.

IP Aliasing HowTo - Gianluca Sironi

3

2 FDL (Free Documentation License)

2

FDL (Free Documentation License)

This document is released under FDL (Free Documentation License) Copyright © 2007 Gianluca Sironi Via Stradella, 7 – 20129 Milano MI gianluca.sironi @ gmail.com

GFDL is available under: http://www.gnu.org/copyleft/fdl.html

4

IP Aliasing HowTo di Gianluca Sironi

3 Configure IP alias

3

Configure IP alias

“IP Aliasing” is the process and the procedure that let to add one (or more) logical interface, each with its own IP address, to a physical interface. Examples ar IP alias for web server Virtual Host (Apache, IIS, ...); it is necessary for HTTPS Virtual Host. Another example is to “bind” a logical interface (an IP alias) for J2EE Application Server (Tomcat, WebSphere, …) or for other services (mail relay, name service, … ). Our best practice is, whenever possible, to bind different TCP/UDP services on different IP addresses and to configure acl and rules at layer 3. In UNIX and Linux we use mostly the command “ifconfig” to show/add/configure/remove logical interfaces. For IP alias we user private IP addressing and the reference is RFC 1918 “Address Allocation for Private Internets”. In this document we show commands and procedure for UNIX (AIX, Solaris, HP-UX), Linux and Windows.

IP Aliasing HowTo - Gianluca Sironi

5

4 UNIX: AIX

4

UNIX: AIX

We start from an IP configuration with a physical interface “en0” with IP address “172.18.76.1”, we can verify the IP configuration whit the ifconfig command: #ifconfig -a en0: flags=4e080863 inet 172.18.76.1 netmask 0xfffff800 broadcast 172.18.79.255 lo0: flags=e08084b inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 inet6 ::1/0 #

To configure an IP alias we use SMIT (SMITTY with a terminal); for example “smitty” with the shortcut for IP configuration: #smitty tcpip

We get : TCP/IP Move cursor to desired item and press Enter. Minimum Configuration & Startup Further Configuration Use DHCP for TCPIP Configuration & Startup IPV6 Configuration Quality of Service Configuration & Startup

Select “Further Configuration”

6

IP Aliasing HowTo di Gianluca Sironi

4 UNIX: AIX

Further Configuration Move cursor to desired item and press Enter. Hostname Static Routes Network Interfaces Name Resolution Client Network Services Server Network Services Manage Print Server Select BSD style rc Configuration Start Configured TCPIP Daemons Stop TCPIP Daemons Authentication Configuration

Select “Network Interfaces”

Network Interfaces Move cursor to desired item and press Enter. Network Interface Selection Network Interface Drivers

Select “Network Interfaces Selection”

Network Interface Selection Move cursor to desired item and press Enter. List All Network Interfaces Add a Network Interface Change / Show Characteristics of a Network Interface Remove a Network Interface Configure Aliases

Select “Configure Aliases”

IP Aliasing HowTo - Gianluca Sironi

7

4 UNIX: AIX

Configure Aliases Move cursor to desired item and press Enter. Add an Add an Remove Remove

IPV6 Network Alias IPV4 Network Alias an IPV6 Network Alias an IPV4 Network Alias

Select “Add an IPV4 Network Alias” The available network interfaces are shown. Available Network Interfaces en0 et0

Standard Ethernet Network Interface IEEE 802.3 Ethernet Network Interface

In our example we select en0 Next screen : Add an IPV4 Network Alias Type or select values in entry fields. Press Enter AFTER making all desired changes.

Network INTERFACE

[Entry Fields]

* IPV4 ADDRESS (dotted decimal) Network MASK (hexadecimal or dotted decimal)

en0 [] []

We insert an IP address and the relative subnet mask; in our example 172.18.76.5 and 255.255.248.0

8

IP Aliasing HowTo di Gianluca Sironi

4 UNIX: AIX

At the end of configuration commands we get the status (“OK” if everything is ok) COMMAND STATUS Command: OK

stdout: yes

stderr: no

Before command completion, additional instructions may appear below. en0 changed

we can exit from “smitty” and we can check the new IP configuration (IP alias) with ifconfig and the switch “-a” #ifconfig -a en0: flags=4e080863 inet 172.18.76.1 netmask 0xfffff800 broadcast 172.18.79.255 inet 172.18.76.5 netmask 0xfffff800 broadcast 172.18.79.255 lo0: flags=e08084b inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255 inet6 ::1/0 #

/etc/hosts

file has to be edited with the correct entries for the IP aliases.

It is possible also to use ifconfig command with the switch “alias”, but it is better to use “smitty tcpip” to check and verify configuration and interfaces (physical and logical).

IP Aliasing HowTo - Gianluca Sironi

9

5 UNIX: Solaris

5

UNIX: Solaris

We start from an IP configuration with a physical interface hme0 and IP address 192.168.28.28, we can verify the IP configuration whit the ifconfig command:

#ifconfig -a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843 mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13

To configure a new logical interface (to the physical interface hme0), as first step we have to “plumb” the new interface (hme0:1) #ifconfig hme0:1 plumb

With the ifconfig command we configure IP address (associated to this new logical interface hme0:1), and netmask and broadcast: #ifconfig hme0:1 192.168.28.29 netmask 255.255.255.0 broadcast 192.168.28.255

Logical interface “hme0:1” has to be “active” (put in “UP” status) #ifconfig hme0:1 up

These three steps (plumb, IP configuration, interface activation), can also be performed with a single command: #ifconfig hme0:1 plumb 192.168.28.29 netmask 255.255.255.0 broadcast 192.168.28.255 up

10

IP Aliasing HowTo di Gianluca Sironi

5 UNIX: Solaris

We check IP configuration with the ifconfig command: #ifconfig -a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843 mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13 hme0:1: flags=1000843 mtu 1500 index 2 inet 192.168.28.29 netmask ffffff00 broadcast 192.168.28.255

Note: it is not possibile to use the logical interface “hme0:0” which is considered the same as hme0.

Solaris permits to use the switch “addif” to the command ifconfig, which makes an “implicit plumb” and assing to the logical interface the next lower available “number”: #ifconfig hme0 addif 192.168.28.30 netmask 255.255.255.0 broadcast 192.168.28.255 up Created new logical interface hme0:2

We check IP configuration with the ifconfig command: #ifconfig -a lo0: flags=1000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 hme0: flags=1000843 mtu 1500 index 2 inet 192.168.28.28 netmask ffffff00 broadcast 192.168.28.255 ether 8:0:20:b3:41:13 hme0:1: flags=1000843 mtu 1500 index 2 inet 192.168.28.29 netmask ffffff00 broadcast 192.168.28.255 hme0:2: flags=1000843 mtu 1500 index 2 inet 192.168.28.30 netmask ffffff00 broadcast 192.168.28.255

IP Aliasing HowTo - Gianluca Sironi

11

5 UNIX: Solaris

Note: when not specified, netmask and broadcast are taken “classful” 192.168.x.y) , /16 e /8 etc ...; in our example we could use :

/24 (for

#ifconfig hme0 addif 192.168.28.30 up

It is always better to specify every IP configuration parameter (netmask, broadcast ...)

file (hard link to file /etc/inet/hosts) has to be edited with the correct entries for the IP aliases. /etc/hosts

/etc/hostname. files have to be created /etc/hostname.hme0:1 e /etc/hostname.hme0:2).

12

and configurated (in our example files

IP Aliasing HowTo di Gianluca Sironi

6 UNIX: HP-UX

6

UNIX: HP-UX

Logical configuration in HP-UX is similar to Sun Solaris, with some differences shown after. In HP-UX it does not exist the switch “–a” for ifconfig command; so to check IP configuration we use lanscan command #lanscan Hardware Path 0/0/0/0 0/8/0/0 0/9/0/0 #

Station Address 0x000F201DCD7D 0x00306EEAB4B5 0x00306EEAF49C

Crd In# 0 1 2

Hdw State UP UP UP

Net-Interface NamePPA lan0 snap0 lan1 snap1 lan2 snap2

NM ID 1 2 3

MAC Type ETHER ETHER ETHER

HP-DLPI Support Yes Yes Yes

DLPI Mjr# 119 119 119

Known the interfaces (physical and eventually logical), all the information about an interface can be obtained with the ifconfig command : #ifconfig lan1 lan1: flags=843 inet 192.168.9.3 netmask ffffff00 broadcast 192.168.9.255 # #ifconfig lan2 lan2: flags=842 inet 0.0.0.0 netmask 0 # Nell’esempio sopra riportato l’interfaccia lan2

IP

configuration

information

/etc/rc.config.d/netconf

are

non ha una configurazione IP

cointained

(and

configurable)

in

the

file

… INTERFACE_NAME[0]=lan0 IP_ADDRESS[0]=192.168.5.8 SUBNET_MASK[0]=255.255.255.0 BROADCAST_ADDRESS[0]=192.168.5.255 INTERFACE_STATE[0]=up DHCP_ENABLE[0]=0

IP Aliasing HowTo - Gianluca Sironi

13

6 UNIX: HP-UX

INTERFACE_NAME[1]=lan1 IP_ADDRESS[1]=192.168.9.3 SUBNET_MASK[1]=255.255.255.0 BROADCAST_ADDRESS[1]=192.168.9.255 INTERFACE_STATE[1]=up INTERFACE_NAME[2]="lan2" IP_ADDRESS[2]="" SUBNET_MASK[2]="" …

In

our

example

we

configure

/etc/rc.config.d/netconf :

a

new

logical

interface

“lan1:1”

editing

file

INTERFACE_NAME[3]="lan1:1" IP_ADDRESS[3]=192.168.9.5 SUBNET_MASK[3]=255.255.255.0 BROADCAST_ADDRESS[3]=192.168.9.255 INTERFACE_STATE[3]=up DHCP_ENABLE[3]=0

Different from Solaris, it is not necessary to “plumb” the interface “lan1:1”; once configured, the logical interface in the file /etc/rc.config.d/netconf, has to be activated with the command : #ifconfig lan1:1 up

IP configuration can be checked with lanscan command, and the specific IP configuration for this new logical interface can be checked with the ifconfig command: #ifconfig lan1:1

/etc/hosts

14

file has to be edited with the correct entries for the IP aliases.

IP Aliasing HowTo di Gianluca Sironi

7 Linux

7

Linux

With Linux (RedHat e derivates distribution like Fedora Core, CentOS, …) configuration files and commands are in /etc/sysconfig/network-scripts/ folder In this example we have two physical interfaces , “eth0” and “eth1”. Logical interfaces, as in Solarsi, are indicated with :n (for example eth0:1). Different from Solaris, with Linux it is possibile to configure a logical interface “:0” (eth0:n con n=0,1,2,...); but we prefer, as in Solaris and HP-UX, to use “1” as first logical interface.

We check IP configuration with the ifconfig command:

# ifconfig -a eth0 Link encap:Ethernet HWaddr 00:30:6E:11:62:D1 inet addr:192.168.206.241 Bcast:192.168.206.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:711872730 errors:0 dropped:0 overruns:0 frame:0 TX packets:777208669 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:3334306770 (3179.8 Mb) TX bytes:3592472187 (3426.0 Mb) Interrupt:11 Base address:0xf000 eth0:1

Link encap:Ethernet HWaddr 00:30:6E:11:62:D1 inet addr:192.168.206.242 Bcast:192.168.206.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:11 Base address:0xf000

eth1

Link encap:Ethernet HWaddr 00:30:6E:11:62:D2 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:11 Base address:0x1000

lo

Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:91410126 errors:0 dropped:0 overruns:0 frame:0 TX packets:91410126 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:950800243 (906.7 Mb) TX bytes:950800243 (906.7 Mb)

IP Aliasing HowTo - Gianluca Sironi

15

7 Linux

Configuration files are in /etc/sysconfig/network-scripts/ directory (both physical and logical interfaces) : -rw-------rw-------rw------…

3 root 1 root 3 root

root root root

169 Mar 138 Mar 73 Dec

8 8 5

2002 ifcfg-eth0 2002 ifcfg-eth0:1 2001 ifcfg-eth1

The content of the configuration files (eth0 physical, eth0:1 logical) are shown : # more ifcfg-eth0 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.206.241 NETMASK=255.255.255.0 TYPE=Ethernet USERCTL=no NETWORK=192.168.206.0 BROADCAST=192.168.206.255 PEERDNS=no # # # more ifcfg-eth0:1 DEVICE=eth0:1 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.206.242 NETMASK=255.255.255.0 TYPE=Ethernet USERCTL=no BROADCAST=192.168.206.255 #

To configure a new logical interface (for example eth0:2) ifcfg-eth0:2 file has to be created and configured. It is possibile (and it is an easy way) to copy the file ifcfg-eth0:1 and to modify only some parameters (device name, IP address, ...) #cp –p ifcfg-eth0:1 ifcfg-eth0:2

16

IP Aliasing HowTo di Gianluca Sironi

7 Linux

This new file ifcfg-eth0:2 has to be modified, for example as shown: DEVICE=eth0:2 ONBOOT=yes BOOTPROTO=static IPADDR=192.168.206.243 NETMASK=255.255.255.0 TYPE=Ethernet USERCTL=no BROADCAST=192.168.206.255

This new logical interface “eht0:2” has to be activated with ifup command (which is a symbolic link to /etc/sbin/ifup command ) # ifup eth0:2

We check IP configuration with the ifconfig command: # ifconfig -a eth0 Link encap:Ethernet HWaddr 00:30:6E:11:62:D1 inet addr:192.168.206.241 Bcast:192.168.206.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:711872730 errors:0 dropped:0 overruns:0 frame:0 TX packets:777208669 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:3334306770 (3179.8 Mb) TX bytes:3592472187 (3426.0 Mb) Interrupt:11 Base address:0xf000 eth0:1

Link encap:Ethernet HWaddr 00:30:6E:11:62:D1 inet addr:192.168.206.242 Bcast:192.168.206.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:11 Base address:0xf000

eth0:2

Link encap:Ethernet HWaddr 00:30:6E:11:62:D1 inet addr:192.168.206.243 Bcast:192.168.206.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:11 Base address:0xf000

eth1

Link encap:Ethernet HWaddr 00:30:6E:11:62:D2 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:11 Base address:0x1000

IP Aliasing HowTo - Gianluca Sironi

17

7 Linux

/etc/hosts

file has to be edited with the correct entries for the IP aliases.

Note: it is possibile to configure a new logical interface (for example eth0:2) with the following command : ifconfig eth0:2 192.168.206.243 netmask 255.255.255.0 up

but with this way the configuration file ifcfg-eth0:2 is not created and with a shutdown of the server, at the next restart the IP alias configuration is lost.

18

IP Aliasing HowTo di Gianluca Sironi

8 Windows

8

Windows

With Microsoft Windows there are several differences, starting from the commands to check IP configuration (“ipconfig” instead of “ifconfig” as in UNIX and Linux). In “Control Panel” select and click on “Network Connections” Select “Local Area Connection”, right-click, select “Properties”

Select “Internet Protocol (TCP/IP)”, click on “Properties” button.

IP Aliasing HowTo - Gianluca Sironi

19

8 Windows

Click on “Advanced ...” button

In “IP Settings” tab. in “IP addresses” click on “Add ...” button

Insert IP address and Subnet mask (in our example 192.168.197.159 and 255.255.255.0)

20

IP Aliasing HowTo di Gianluca Sironi

8 Windows

In “IP settings” now there is also this new logical interface.

From a command prompt “ipconfig /all” command

IP Aliasing HowTo - Gianluca Sironi

we

can

check

IP

configuration

with

21

9 References

9 ●

22

References RFC 1918 “Address Allocation for Private Internets”

IP Aliasing HowTo di Gianluca Sironi

Related Documents

Ip Aliasing Howto En
May 2020 12
Anti Aliasing
April 2020 5
Linux Ipv6 Howto (en)
June 2020 11
Howto
May 2020 48
Howto
May 2020 35