On Thu, Jul 25, 2013 at 8:50 PM, Jonathan Callen <jcal...@gentoo.org> wrote:
> On 07/25/2013 11:42 AM, Canek Peláez Valdés wrote:
>> On Thu, Jul 25, 2013 at 5:46 AM, Michael Hampicke <m...@hadt.biz>
>> wrote:
>>> What do you use - and what are the benefits of your method?
>>
>> I use the following unit in one of my servers:
>>
>> # 
>> -------------------------------------------------------------------------------------------
>> [Unit]
>> Description=Static network service
>> After=local-fs.target
>> Documentation=man:ifconfig(8)
>> Documentation=man:route(8)
>>
>> [Service]
>> Type=oneshot
>> RemainAfterExit=yes
>> ExecStart=/bin/ifconfig <DEVICE> <IP> broadcast <BCAST> netmask
> <NETMASK> up
>> ExecStart=/bin/route add default gw <GW> <DEVICE>
>> #
> -------------------------------------------------------------------------------------------
>>
>
> I would recommend replacing those two commands with:
>
> ExecStart=/bin/ip addr add <IP>/<CIDR> dev <DEVICE>
> ExecStart=/bin/ip route add default via <GW> dev <DEVICE>
>
> This uses the newer iproute2 infrastructure, which is supposed to
> replace the deprecated net-tools package (last official release was in
> 2001).
>
> Note also that this uses the CIDR notation for IP addresses.  If you
> were previously using "ifconfig eth0 192.168.1.5 broadcast
> 192.168.1.255 netmask 255.255.255.0", you can simply say "ip addr add
> 192.168.1.5/24 dev eth0" which calculates both netmask and broadcast
> from the "/24" (which means the upper 24 bits are used).

Thanks for the heads up.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México

Reply via email to