From: kurt on
Awesome! Thanks for that, Jerry.

Kurt


Jerry Peters wrote:
> kurt <kurtl(a)olypen.com> wrote:
>> Jonathan wrote:
>>> Hi - I've got a machine that for various reason I cannot have a static
>>> IP address for on the LAN. I also need to ssh in and admin the box
>>> (and I can't keep a monitor attached to it).
>>>
>>> So my first thought was to try and give the box a dhcp lease on the
>>> primary interface (eth0) and a static address on a different network
>>> on eth0:0. I would then configure my client machine to also have an
>>> alias on that network. That way, the box would be able to get to the
>>> net via the dhcp lease, and I would be able to ssh in via its static
>>> IP.
>>>
>>> Like this:
>>>
>>> # The primary network interface (dynamic)
>>> allow-hotplug eth0
>>> iface eth0 inet dhcp
>>>
>>> # The secondary interface (static)
>>> auto eth0:0 inet static
>>> address 192.168.1.1
>>> netmask 255.255.255.0
>>> network 192.168.0.0
>>> gateway 192.168.1.1
>>>
>>> (note that the dhcp leases are in the range 172.20.*.*)
>>>
>>> However, when I try that, I get:
>>>
>>> /etc/init.d/networking restart
>>> Reconfiguring network interfaces.../etc/network/interfaces:16:
>>> misplaced option
>>> ifdown: couldn't read interfaces file "/etc/network/interfaces"
>>> /etc/network/interfaces:16: misplaced option
>>> ifup: couldn't read interfaces file "/etc/network/interfaces"
>>>
>>> Does anyone know if it's even possible to do this? If so, how?
>>>
>>> Thanks.
>>>
>> You could make a reservation for your workstation's MAC address at the
>> DHCP server. It would still be getting its address and all of the
>> options via DHCP, but you would be guaranteed the same IP address every
>> time.
>>
>> I don't think you can have a static and a dynamic configuration on the
>> same physical interface (though I'm sure someone may prove me wrong).
>>
>> Kurt
>>
> Of course you can. You just set up dhclient with an alias.
>
> /etc/dhclient.conf:
>
> interface "eth0" {
> script "/etc/dhclient-script";
> send host-name "peregrine";
> request subnet-mask, broadcast-address, time-offset, routers,
> domain-name, domain-name-servers, host-name,
> interface-mtu;
> require subnet-mask, domain-name-servers;
> default domain-name "verizon.net";
> }
>
> alias { interface "eth0";
> fixed-address 172.23.77.6;
> option subnet-mask 255.255.255.0;
> }
>
> This gets a dynamic address from the DSL modem/router and also creates
> an alias interface for the internal lan, with a fixed address.
>
> Now how you accomplish this with certain distributions fancy network
> scripts I have no idea, but it _can_ be done.
>
> Jerry
From: Charlie Gibbs on
In article <Tf2dnf4ZooeNMs3VnZ2dnUVZ_uCdnZ2d(a)posted.olypeninternet>,
kurtl(a)olypen.com (kurt) writes:

> I don't think you can have a static and a dynamic configuration on the
> same physical interface (though I'm sure someone may prove me wrong).

Sure you can. I tell my DHCP server not to assign any addresses
below 192.168.0.32, and put all my static addresses in that range.

--
/~\ cgibbs(a)kltpzyxm.invalid (Charlie Gibbs)
\ / I'm really at ac.dekanfrus if you read it the right way.
X Top-posted messages will probably be ignored. See RFC1855.
/ \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!