# Arrg... IP alias troubles

## baylock

please help....

recently i needed to rebuild my gentoobox, and noticed something about the base layout... so i upgraded it.

now im stuck with a problem.

a litttle background first.

When i moved in with some mates they already had a network up and running, so it was jsut a case of getting the box to work with it,

first thin i tryed was static IP, and the box worked, and all, but i could not get on the internet with it. so i come to the conclusion of useing dhcp. the problem with that was that the IP would keep changeing on each boot, so i assighned som alias's in the /ect/conf.d/net file, and everything worked.

for some reason the router we are useing will not let an IP connect to the net unless it was assighned by dhcp. So with dhcp up an running, and alias's assighned everything was great.

now with the new base lay out, the alias_eth0="xxx.xxx.xxx.xxx" command does not work.

does any one know how to assighn eather an alias, or preferably something like a hostname that i can use putty to access the system with?? as i am unable to ping the box via the hostname  i have set in the hostname file

and yes i searched, eather im searching for the wrong thing, or not understanding the answers... thanc for your help

----------

## the_mgt

Can't you just hardwire an ip to your MAC adress?

Or change the lease time to something longer than a year.

What is the dhcp server you are using for your network? Both solutions only work if you have acces to the dhcp server.

Hostnames only work, if you have a DNS Server on your network.

----------

## UberLord

Here's the problem.

baselayout-1.8 and earlier where ifconfig only and supported the iface="foo" alias="bar" syntax

baselayout-1.9 introduced iproute2 syntax iproute_eth0 (no aliases) and ifconfig_eth0 with the old iface aliases syntax

baselayout-1.10 was a bust

baselayout-1.11 joined the two together with a universal config_eth0=( "addr1" "addr2" ) syntax which also took care of aliases

baselayout-1.11 also defaulted to ifconfig so the joining was pretty much error free.

With baselayout-1.12.0 we are confident we have joined to two - but with one exception. The old way of doing aliases is ifconfig specific and we have changed the default to iproute2. iproute2 has no concept of an "alias" (which is basically a work-around for an ifconfig limitation) and neither do modern kernels as it's still the same interface.

I would rather bring peoples config up to date with modern concepts and ideals rather than support aliases.

If you disagree, open a bug. I'll close it and explain why - basically what I've said here. If a patch is provided (to the 1.12.0 series) then I may listen.

Have a nice day  :Smile: 

----------

## baylock

Thax uber... i think i understsand.

basicly to make lots of other things work better, some others had to be sacrificed??

fair nuf...

how about getting it to broadcast the hoas name?? im probably missing something simple to get it to work, but i just cant seem to get it to work.

once again thanx for your help

----------

## UberLord

 *baylock wrote:*   

> how about getting it to broadcast the hoas name?? im probably missing something simple to get it to work, but i just cant seem to get it to work.

 

You don't broadcast the hostname as such. You need to register your hostname with a DNS server. This can be accomplished by using a DHCP server on the same machine as the DNS server and get the two to talk to each other

DHCP - "Hey DNS,I got a machine called 'foo' and I've given him 1.1.1.2"

DNS - "OK - I'll instruct everyone that 'foo' is 1.1.1.2 until you tell me that foo has released"

dnsmasq in portage does both DNS and DHCP and is very easy to setup

----------

## baylock

ok... kewl... looks like lease times for me then... thanx for ur time

----------

## STEDevil

 *UberLord wrote:*   

> 
> 
> baselayout-1.11 joined the two together with a universal config_eth0=( "addr1" "addr2" ) syntax...
> 
> With baselayout-1.12.0 we are confident we have joined to two - but with one exception. The old way of doing aliases is ifconfig specific and we have changed the default to iproute2. iproute2 has no concept of an "alias" (which is basically a work-around for an ifconfig limitation) and neither do modern kernels as it's still the same interface.
> ...

 

Ok, but if there will be no aliases, how will I NAT between LAN & WAN with only 1 NIC in the box once I upgrade from baselayout 1.11 to 1.12? TIA

----------

## akbarstatx

iproute may not technically support aliases but it does allow you to label an interface so that ifconfig displays the labeled interface as an alias. e.g.

```

ip addr add 192.168.0.1/24 dev eth0 brd 192.168.0.255 label eth0:0

```

This interface will show up in ifconfig as eth0:0.

So what I don't understand is why using iproute in conf.d/net exclusively or preferentially is not able to use the label syntax to create an alias.  The iproute docs say the label syntax is usefull for backwards compatibilty with ifconfig style aliasing.

----------

## UberLord

 *akbarstatx wrote:*   

> So what I don't understand is why using iproute in conf.d/net exclusively or preferentially is not able to use the label syntax to create an alias.  The iproute docs say the label syntax is usefull for backwards compatibilty with ifconfig style aliasing.

 

You said it yourself - it's for backwards compatibilty.

Basic rule of thumb with >1 address

ifconfig - requires aliases so you get aliases

iproute2 does not so you don't

----------

## red-wolf76

EDIT: The problem was solved by adding the default route, in my case route add default gw 192.168.1.1. Haven't the foggiest why my config didn't do that. Has the sensitivity to comments increased, by any chance? The commented lines are kept in the config because I sometimes move the box to my network at home.

EDIT2: *bump* The problem persists after re-booting. Even though I have defined the default via, as per spec, I positively must manually add the route to be able to access the internet. What gives? Sth broken? Output of route is as follows:

```
Kernel IP Routentabelle

Ziel            Router          Genmask         Flags Metric Ref    Use Iface

default         192.168.1.1     255.255.255.255 UGH   0      0        0 eth0

192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo
```

```
Kernel IP Routentabelle

Ziel            Router          Genmask         Flags Metric Ref    Use Iface

default         192.168.1.1     255.255.255.255 UGH   0      0        0 eth0

192.168.1.0     *               255.255.255.0   U     0      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
```

Hi, I've got an idiotic question but my box is unable to reach the internet via our router, while local networking is just fine.

Here's my /etc/conf.d/net:

```
# /etc/conf.d/net:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 $

modules=(

"ifconfig"

)

config_eth0=(

"192.168.1.111/24"

)

#config_eth0=(

#"192.168.6.102/24"

#"192.168.0.102/24"

#"192.168.1.102/24"

#"192.168.2.102/24"

#)

dns_servers=(

"192.168.1.1"

#"192.168.6.1"

)

gateways=(

"192.168.1.1"

#"192.168.6.1"

)

routes_eth0=(

"default via 192.168.1.1"

#"default via 192.168.6.1"

)

mtu_eth0=1492
```

It worked up to my installing (yes, I may be getting what I deserve) baselayout-1.12.7 yesterday. But yes, I did update all config files  :Wink: .

I get a "network unreachable" upon trying to ping anything other than my subnet. The router connects other boxen (running various windows versions) on the network to the internet just fine.

Now, I fear that my box at home (on which I also updated baselayout, but had trouble) will have the same problem.

----------

