1 |
Am 25.07.2013 17:42, schrieb Canek Peláez Valdés: |
2 |
|
3 |
>> What do you use - and what are the benefits of your method? |
4 |
> |
5 |
> I use the following unit in one of my servers: |
6 |
> |
7 |
> # ------------------------------------------------------------------------------------------- |
8 |
> [Unit] |
9 |
|
10 |
|
11 |
My current version, using "ip" : |
12 |
|
13 |
# cat network.service |
14 |
[Unit] |
15 |
Description=Network Connectivity |
16 |
|
17 |
[Service] |
18 |
Type=oneshot |
19 |
RemainAfterExit=yes |
20 |
|
21 |
EnvironmentFile=/etc/conf.d/network_systemd |
22 |
ExecStart=/bin/ip link set dev ${interface} up |
23 |
ExecStart=/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} |
24 |
dev ${interface} |
25 |
ExecStart=/bin/ip route add default via ${gateway} |
26 |
|
27 |
ExecStop=/bin/ip addr flush dev ${interface} |
28 |
ExecStop=/bin/ip link set dev ${interface} down |
29 |
|
30 |
[Install] |
31 |
WantedBy=network.target |
32 |
|
33 |
----- so that unitfile does not have to be touched again and you only |
34 |
edit /etc/conf.d/network_systemd -> |
35 |
|
36 |
# cat /etc/conf.d/network_systemd |
37 |
PATH=/sbin:/usr/sbin |
38 |
interface=p4p1 |
39 |
address=192.x.y.z |
40 |
netmask=255.255.255.0 |
41 |
broadcast=192.x.y.zz |
42 |
gateway=192.x.y.zzz |
43 |
|
44 |
----- |
45 |
|
46 |
I have a second unitfile with a more complicated setup for bridging |
47 |
(with KVM). |
48 |
|
49 |
Stefan |