# How to control (up/down) a virtual IP interface (eth0:1)

**URL:** <https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626>\
**Category:** SLES Configure-Administer\
**Created:** [May 15, 2012, 3:12pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626 "2012-05-15T15:12:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 15, 2012, 3:12pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/1 "2012-05-15T15:12:55Z")

</div>

Hello all,

I am looking for a method to control virtual IPs (IP aliases) like an real interface with ifconfig/ip or ifup/-down.

The reason: I want to run a BIND on 2 machines with 2 separate IP addresses and on shared (service) IP address.

In other Linux distributions it goes like (i.e.)  
ifconfig eth0:1 address 192.168.10.10 netmask 255.255.255.0  
ifconfig eth0:1 up

That doesn’t work in SLESS 11. I can create a virtual interface and use it but I cannot take ist down or up independed from the parent interface (i.e. eth0).

I appreciate any answers !

Thanks in advance !

Udo

---

<div class="post-metadata">

**Author:** ![J.M](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@J.M](https://forums.suse.com/u/J.M)\
**Post date:** [May 15, 2012, 3:27pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/2 "2012-05-15T15:27:07Z")

</div>

[QUOTE=UZumdick;4589]Hello all,

I am looking for a method to control virtual IPs (IP aliases) like an real interface with ifconfig/ip or ifup/-down.

The reason: I want to run a BIND on 2 machines with 2 separate IP addresses and on shared (service) IP address.

In other Linux distributions it goes like (i.e.)  
ifconfig eth0:1 address 192.168.10.10 netmask 255.255.255.0  
ifconfig eth0:1 up

That doesn’t work in SLESS 11. I can create a virtual interface and use it but I cannot take ist down or up independed from the parent interface (i.e. eth0).

I appreciate any answers !

Thanks in advance !

Udo[/QUOTE]

What does ‘ifconfig’ and/or ‘ip addr’ say?

---

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 15, 2012, 4:01pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/3 "2012-05-15T16:01:12Z")

</div>

pns1:/opt/dns # ifup eth0:1  
Interface eth0:1 is not available

pns1:/opt/dns # ifdown eth0:1  
eth0:1 no such interface  
interface eth0:1 is not available

ifconfig eth0:1 down deletes the whole virtual interface eth0:1  
therefore it can’t be activated the same way:

ifconfig eth0:1 up  
pns1:/opt/dns # ifconfig eth0:1 up  
SIOCSIFFLAGS: Cannot assign requested address

-Udo

---

<div class="post-metadata">

**Author:** ![J.M](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@J.M](https://forums.suse.com/u/J.M)\
**Post date:** [May 15, 2012, 4:02pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/4 "2012-05-15T16:02:03Z")

</div>

[QUOTE=UZumdick;4591]pns1:/opt/dns # ifup eth0:1  
Interface eth0:1 is not available

pns1:/opt/dns # ifdown eth0:1  
eth0:1 no such interface  
interface eth0:1 is not available

ifconfig eth0:1 down deletes the whole virtual interface eth0:1  
therefore it can’t be activated the same way:

ifconfig eth0:1 up  
pns1:/opt/dns # ifconfig eth0:1 up  
SIOCSIFFLAGS: Cannot assign requested address

-Udo[/QUOTE]

Does not answer my question…

---

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 15, 2012, 4:13pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/5 "2012-05-15T16:13:15Z")

</div>

Sorry, but then I don’t understand your question. ☹

I described the way I used the commands ifconfig and ifup(-down) and gave the output of theses commands

?-)

---

<div class="post-metadata">

**Author:** ![J.M](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@J.M](https://forums.suse.com/u/J.M)\
**Post date:** [May 15, 2012, 4:17pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/6 "2012-05-15T16:17:42Z")

</div>

[QUOTE=UZumdick;4594]Sorry, but then I don’t understand your question. ☹

I described the way I used the commands ifconfig and ifup(-down) and gave the output of theses commands

?-)[/QUOTE]

I merely asked for the output of

```auto
ifconfig
```

and

```auto
ip addr
```

---

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 15, 2012, 4:46pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/7 "2012-05-15T16:46:59Z")

</div>

Oh, ok. I am sorry 🕶  
Here I tried it with eth1

ifconfig:  
eth0 Link encap:Ethernet HWaddr 5C:F3:FC:E5:F0:20  
inet addr:192.168.19.186 Bcast:192.168.19.255 Mask:255.255.254.0  
inet6 addr: 2003:4:f023:8000:5ef3:fcff:fee5:f020/64 Scope:Global  
inet6 addr: fe80::5ef3:fcff:fee5:f020/64 Scope:Link  
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1  
RX packets:101 errors:0 dropped:0 overruns:0 frame:0  
TX packets:25 errors:0 dropped:0 overruns:0 carrier:0  
collisions:0 txqueuelen:1000  
RX bytes:7316 (7.1 Kb) TX bytes:6981 (6.8 Kb)  
Interrupt:28 Memory:96000000-96012800

eth1 Link encap:Ethernet HWaddr 5C:F3:FC:E5:F0:22  
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0  
UP 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:1000  
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)  
Interrupt:40 Memory:98000000-98012800

eth1:1 Link encap:Ethernet HWaddr 5C:F3:FC:E5:F0:22  
inet addr:192.168.1.13 Bcast:192.168.1.255 Mask:255.255.255.0  
UP BROADCAST MULTICAST MTU:1500 Metric:1  
Interrupt:40 Memory:98000000-98012800

eth2 Link encap:Ethernet HWaddr 5C:F3:FC:6A:7A:DC  
UP BROADCAST SLAVE 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:1000  
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)  
Interrupt:29 Memory:92000000-92012800

eth3 Link encap:Ethernet HWaddr 5C:F3:FC:6A:7A:DC  
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1  
RX packets:16 errors:0 dropped:138 overruns:0 frame:0  
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0  
collisions:0 txqueuelen:1000  
RX bytes:1024 (1024.0 b) TX bytes:492 (492.0 b)  
Interrupt:41 Memory:94000000-94012800

lo Link encap:Local Loopback  
inet addr:127.0.0.1 Mask:255.0.0.0  
inet6 addr: ::1/128 Scope:Host  
UP LOOPBACK RUNNING MTU:16436 Metric:1  
RX packets:15854 errors:0 dropped:0 overruns:0 frame:0  
TX packets:15854 errors:0 dropped:0 overruns:0 carrier:0  
collisions:0 txqueuelen:0  
RX bytes:1584463 (1.5 Mb) TX bytes:1584463 (1.5 Mb)

ip addr

1: lo: \<LOOPBACK,UP,LOWER\_UP\> mtu 16436 qdisc noqueue state UNKNOWN  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
inet 127.0.0.1/8 brd 127.255.255.255 scope host lo  
inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo  
inet6 ::1/128 scope host  
valid\_lft forever preferred\_lft forever  
2: eth0: \<BROADCAST,MULTICAST,UP,LOWER\_UP\> mtu 1500 qdisc mq state UP qlen 1000  
link/ether 5c:f3:fc:e5:f0:20 brd ff:ff:ff:ff:ff:ff  
inet 192.168.19.186/23 brd 192.168.19.255 scope global eth0  
inet6 2003:4:f023:8000:5ef3:fcff:fee5:f020/64 scope global dynamic  
valid\_lft 2591998sec preferred\_lft 604798sec  
inet6 fe80::5ef3:fcff:fee5:f020/64 scope link  
valid\_lft forever preferred\_lft forever  
3: eth1: \<NO-CARRIER,BROADCAST,MULTICAST,UP\> mtu 1500 qdisc mq state DOWN qlen 1000  
link/ether 5c:f3:fc:e5:f0:22 brd ff:ff:ff:ff:ff:ff  
inet 192.168.1.11/24 brd 192.168.1.255 scope global eth1  
inet 192.168.1.13/24 brd 192.168.1.255 scope global secondary eth1:1  
4: eth2: \<NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP\> mtu 1500 qdisc mq master bond0 state DOWN qlen 1000  
link/ether 5c:f3:fc:6a:7a:dc brd ff:ff:ff:ff:ff:ff  
5: eth3: \<BROADCAST,MULTICAST,SLAVE,UP,LOWER\_UP\> mtu 1500 qdisc mq master bond0 state UP qlen 1000  
link/ether 5c:f3:fc:6a:7a:dc brd ff:ff:ff:ff:ff:ff  
6: usb0: \<BROADCAST,MULTICAST\> mtu 1500 qdisc pfifo\_fast state DOWN qlen 1000  
link/ether 5e:f3:fc:dd:f0:23 brd ff:ff:ff:ff:ff:ff

---

<div class="post-metadata">

**Author:** ![J.M](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@J.M](https://forums.suse.com/u/J.M)\
**Post date:** [May 15, 2012, 5:18pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/8 "2012-05-15T17:18:19Z")

</div>

> [@UZumdick;4596](#):
>
> 3: eth1: \<NO-CARRIER,BROADCAST,MULTICAST,UP\> mtu 1500 qdisc mq state DOWN qlen 1000  
> link/ether 5c:f3:fc:e5:f0:22 brd ff:ff:ff:ff:ff:ff  
> inet 192.168.1.11/24 brd 192.168.1.255 scope global eth1  
> inet 192.168.1.13/24 brd 192.168.1.255 scope global secondary eth1:1

What you want/should use is probably something along the lines of

```auto
ip addr add 192.168.1.13/24 dev eth1
ip addr del 192.168.1.13/24 dev eth1
```

---

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 15, 2012, 5:28pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/9 "2012-05-15T17:28:25Z")

</div>

Do you mean without any virtual ip configuration ?

In my config

# ip addr add 192.168.1.13/24 dev eth1

does nothing - ifconfig:  
[…]  
eth1 Link encap:Ethernet HWaddr 5C:F3:FC:E5:F0:22  
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0  
UP 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:1000  
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)  
Interrupt:40 Memory:98000000-98012800

But a second invocation gives an error message:  
pns1:/etc/sysconfig/network # ip addr add 192.168.1.13/24 dev eth1  
RTNETLINK answers: File exists

But I can’t see the virtual interface.

# ip addr del 192.168.1.13/24 dev eth1

Deletes also the whole virtual interface, like ifconfig does.

-Udo

---

<div class="post-metadata">

**Author:** ![J.M](https://avatars.discourse-cdn.com/v4/letter/j/db5fbb/32.png) [@J.M](https://forums.suse.com/u/J.M)\
**Post date:** [May 15, 2012, 5:44pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/10 "2012-05-15T17:44:32Z")

</div>

[QUOTE=UZumdick;4598]Do you mean without any virtual ip configuration ?

In my config

# ip addr add 192.168.1.13/24 dev eth1

does nothing - ifconfig:  
[…]  
eth1 Link encap:Ethernet HWaddr 5C:F3:FC:E5:F0:22  
inet addr:192.168.1.11 Bcast:192.168.1.255 Mask:255.255.255.0  
UP 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:1000  
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)  
Interrupt:40 Memory:98000000-98012800  
[/QUOTE]

Yes it does something, but you need to look at it using ‘ip addr’.

ifconfig is the old way of doing things.

Nowadays you no longer need an alias (ethx:n) for a secondary IP (what you call virtual, I guess) to work.

> [@](#):
>
> But a second invocation gives an error message:  
> pns1:/etc/sysconfig/network # ip addr add 192.168.1.13/24 dev eth1  
> RTNETLINK answers: File exists
> 
> But I can’t see the virtual interface.

As I said, not using ‘ifconfig’, but you see the secondary using ‘ip addr’.

[QUOTE]

# ip addr del 192.168.1.13/24 dev eth1

Deletes also the whole virtual interface, like ifconfig does.

-Udo[/QUOTE]

Well, technically you do the following, so there is no real up/down for the secondary. At least I wouldn’t know spontaneously how to up/down it (ie. remember it while attributing some state to it).

```auto
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
    inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:ac:00:28 brd ff:ff:ff:ff:ff:ff
    inet 192.168.98.103/24 brd 192.168.98.255 scope global eth0
# ip addr add 192.168.98.69/24 dev eth0
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
    inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:ac:00:28 brd ff:ff:ff:ff:ff:ff
    inet 192.168.98.103/24 brd 192.168.98.255 scope global eth0
    inet 192.168.98.69/24 scope global secondary eth0
# ip addr del 192.168.98.69/24 dev eth0
# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
    inet 127.0.0.2/8 brd 127.255.255.255 scope host secondary lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:56:ac:00:28 brd ff:ff:ff:ff:ff:ff
    inet 192.168.98.103/24 brd 192.168.98.255 scope global eth0
```

You don’t see anything of the secondary interfaces in ifconfig. Anyway, why do you want/need to?

---

<div class="post-metadata">

**Author:** ![UZumdick](https://avatars.discourse-cdn.com/v4/letter/u/ee7513/32.png) [@UZumdick](https://forums.suse.com/u/UZumdick)\
**Post date:** [May 21, 2012, 12:08pm UTC](https://forums.suse.com/t/how-to-control-up-down-a-virtual-ip-interface-eth0-1/22626/11 "2012-05-21T12:08:45Z")

</div>

Sorry for the delay, we had some spare days here in Germany 🙂

> You don’t see anything of the secondary interfaces in ifconfig. Anyway, why do you want/need to?

My plan was to let BIND 9.x Nameserver bind 2 addresses: The real one and the virtual one. This should be done on two machines.  
The virtual IP address should be the service IP which will be used by customers.  
Only the active one of the two machines should have the virtual IP up and thsi should change in case of failure.  
But BIND cannot bind an address until the interface is configured/visible. So that’s my problem.  
So, if I bring down an interface with ifconfig BIND can still see the interface. If I do this with ip addr instead BIND cannot see the interface and will not use it until a complete restart (what will, unfortunately take to much time).
