-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path53-ec2-network-interfaces.rules
35 lines (31 loc) · 1.68 KB
/
53-ec2-network-interfaces.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Copyright (C) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the
# License.
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", IMPORT{program}="/bin/sleep 1"
# ec2net.hotplug writes interface config for new interfaces, and adds or
# removes source routes. It exits if network.service has not yet come up.
SUBSYSTEM=="net", RUN+="/etc/sysconfig/network-scripts/ec2net.hotplug"
# During bootup with an unconfigured ENI, the udev add event is fired more than
# once (the usual boot event, and another created later by ec2ifscan, which is
# run by elastic-network-interfaces.service). The following rule has to use
# 'systemctl start' rather than ENV{SYSTEMD_WANTS} because systemd doesn't
# keep trying to start the service in the WANTS case.
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*", \
RUN+="/usr/bin/systemctl start ec2-ifup@$env{INTERFACE}"
# A remove event may be for an interface which was started by network.service
# (if config existed at boot) or by ec2-ifup@.service. In the latter case,
# systemd should kill dhclient when the device disappears. Still have to run
# ifdown to kill dhclient in the former case.
ACTION=="remove", SUBSYSTEM=="net", KERNEL=="eth*", \
RUN+="/sbin/ifdown $env{INTERFACE}"