Re: ifconfig inet dhcp and static alias support

2016-01-17 Thread Stuart Henderson
> On Sun, Jan 17, 2016 at 12:21:51PM -0800, Yury Shefer wrote:
>> I was not able to find the information about ifconfig support for the IPv4
>> address configuration where I have primary address assigned by DHCP
>> (Comcast) and alias with static IP. My cable modem mgmt IP belongs to
>> 192.168.100.0/24 subnet and to access it - I have to add an alias - but it
>> always overwrite DHCP-assigned address (OpenBSD 5.8-stable (GENERIC.MP)).

It's not possible to do this with the DHCP client from base at
present.

On 2016-01-17, Josh Grosse  wrote:
> Instead of seting an alias, just route the 192.168.100/24 subnet through your 
> upstream gateway.
>
> In my case, none of my inner subnets are 192.168.100/24, so any packets
> to that subnet go to the default route assigned by dhcp.

That's not always possible. Sometimes you need to use (and respond
to ARP queries for) an address in the same subnet.

Fortunately in my case I don't have the need to do this very
often so I can cope with 'pkill -9 dhclient' to force it to exit
without removing the existing lease. That's not always acceptable
though - if there's no other way around it, using a 3rd-party
DHCP client is currently the only way.



ifconfig inet dhcp and static alias support

2016-01-17 Thread Yury Shefer
Hi misc,

I was not able to find the information about ifconfig support for the IPv4
address configuration where I have primary address assigned by DHCP
(Comcast) and alias with static IP. My cable modem mgmt IP belongs to
192.168.100.0/24 subnet and to access it - I have to add an alias - but it
always overwrite DHCP-assigned address (OpenBSD 5.8-stable (GENERIC.MP)).

I tried the following hostname.if config but the last line overwrite dhcp
address:

$ cat /etc/hostname.em0
lladdr b8:c7:ff:cd:ff:0e
dhcp
up
rtsol
inet alias 192.168.100.50 255.255.255.0

# sh /etc/netstart em0
em0: no link . got link
DHCPREQUEST on em0 to 255.255.255.255
DHCPACK from 96.xxx.xx.113 (00:01:5c:63:fc:46)
bound to 67.xxx.xx.xx9 -- renewal in 92649 seconds.
# ifconfig em0
em0: flags=208843 mtu 1500
lladdr b8:c7:ff:cd:ff:0e
priority: 0
groups: egress
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet6 fe80::bac7::abcd:abc%em0 prefixlen 64 scopeid 0x1
inet6 2001:abc:dead:10d:beef:be0b:2e16:9486 prefixlen 128 pltime
343370 vltime 343370
inet 192.168.100.50 netmask 0xff00 broadcast 192.168.100.255


-- 
Best regards,
Yury.



Re: ifconfig inet dhcp and static alias support

2016-01-17 Thread Josh Grosse
On Sun, Jan 17, 2016 at 12:21:51PM -0800, Yury Shefer wrote:
> Hi misc,
> 
> I was not able to find the information about ifconfig support for the IPv4
> address configuration where I have primary address assigned by DHCP
> (Comcast) and alias with static IP. My cable modem mgmt IP belongs to
> 192.168.100.0/24 subnet and to access it - I have to add an alias - but it
> always overwrite DHCP-assigned address (OpenBSD 5.8-stable (GENERIC.MP)).
> 
> I tried the following hostname.if config but the last line overwrite dhcp
> address:
> 
> $ cat /etc/hostname.em0
> lladdr b8:c7:ff:cd:ff:0e
> dhcp
> up
> rtsol
> inet alias 192.168.100.50 255.255.255.0
> 
> # sh /etc/netstart em0
> em0: no link . got link
> DHCPREQUEST on em0 to 255.255.255.255
> DHCPACK from 96.xxx.xx.113 (00:01:5c:63:fc:46)
> bound to 67.xxx.xx.xx9 -- renewal in 92649 seconds.
> # ifconfig em0
> em0: flags=208843 mtu 1500
> lladdr b8:c7:ff:cd:ff:0e
> priority: 0
> groups: egress
> media: Ethernet autoselect (1000baseT full-duplex)
> status: active
> inet6 fe80::bac7::abcd:abc%em0 prefixlen 64 scopeid 0x1
> inet6 2001:abc:dead:10d:beef:be0b:2e16:9486 prefixlen 128 pltime
> 343370 vltime 343370
> inet 192.168.100.50 netmask 0xff00 broadcast 192.168.100.255
 
Instead of seting an alias, just route the 192.168.100/24 subnet through your 
upstream gateway.

In my case, none of my inner subnets are 192.168.100/24, so any packets
to that subnet go to the default route assigned by dhcp.



Re: ifconfig inet dhcp and static alias support

2016-01-17 Thread Gregor Best
Hi Yury,

On Sun, Jan 17, 2016 at 12:21:51PM -0800, Yury Shefer wrote:
> [...]
> I was not able to find the information about ifconfig support for the IPv4
> address configuration where I have primary address assigned by DHCP
> (Comcast) and alias with static IP. My cable modem mgmt IP belongs to
> 192.168.100.0/24 subnet and to access it - I have to add an alias - but it
> always overwrite DHCP-assigned address (OpenBSD 5.8-stable (GENERIC.MP)).
> [...]

You might get somewhere by creating a bridge(4) interface, adding em0 to
that and adding a vether(4) to the bridge. dhclient would then run on
em0, adding and removing dynamically assigned IPv4-addresses, while
the vether has a static address:

# ifconfig bridge0 create
# ifconfig vether0 create inet 192.168.100.200/24 up
# ifconfig bridge0 add vether0
# ifconfig bridge0 add em0
# dhclient em0

The proper incantations in /etc/hostname.{bridge,vether,em}0 are left as
an exercise for the reader.

-- 
Gregor