我正在尝试在 linode 计算机上安装 alpine 服务器。
这是来自 linode 的一个教程,展示了如何在他们的主机上安装 alpine,我经常这样做,因此我编写了一个支持我的脚本,可以在不到 2 分钟的时间内完成此操作:
这是我的脚本
https://github.com/exocode/alpine-linode-bootstrap/
重新启动这款新的 Alpine 后,我执行以下操作:
这是我的整个历史
0 clear
1 cat /etc/network/interfaces
2 apk add iptables
3 rc-update add iptables boot
4 apk add iptables-persistent
5 iptables save
6 /etc/init.d/iptables save
7 service iptables save
8 service networking restart
9 cat /etc/network/interfaces
10 ping -c 2 google.com
11 passwd
12 adduser example-user
13 edituser example-user
14 deluser example-user
15 cat /etc/group
16 adduser example-user
17 apk add sudo
18 echo "%sudo ALL=(ALL) ALL" >> /etc/sudoers
19 addgroup sudo
20 adduser example-user sudo
21 mkdir -p ~/.ssh && chmod -R 700 ~/.ssh/
22 setup-sshd
23 vi /etc/apk/repositories
24 apk update
25 apk add docker
26 rc-update add docker boot
27 iptables -L
28 cat /etc/network/interfaces
29 iptables -L
30 service docker start
31 iptables -L
32 cat /etc/network/interfaces
33
34 service -l
35 service networking restart
36 cat /etc/network/interfaces
37 iptables -L
38 ip addr
39 service networking restart
40 setup-interfaces
41 service networking restart
42 cat /etc/network/interfaces
43 history
44 clear
45 cat /etc/network/interfaces
46 ip addr
47 clear
48 histo
49 history
/interfaces 和 iptables 的信息
alpine:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto docker0
iface docker0 inet static
address 172.17.0.1
netmask 255.255.0.0
auto eth0
iface eth0 inet dhcp
hostname alpine
alpine:~# ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether f2:3c:91:e7:38:9c brd ff:ff:ff:ff:ff:ff
inet _139.162.1.56/24 brd 139.162.1.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2400:8901::f03c:91ff:fee7:389c/64 scope global dynamic
valid_lft 2591996sec preferred_lft 604796sec
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
link/ether 02:42:16:3e:75:48 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 scope global docker0
valid_lft forever preferred_lft forever
我的目标
__ 是在 linode 上运行一个 docker 应用程序__
我的问题
如果我在成功安装 Alpine 之后重新启动我的 linode,并再次重新启动,我的 eth0 IP 就消失了!
如何在不丢失 IP 设置的情况下重新启动服务器:
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether f2:3c:91:e7:38:9c brd ff:ff:ff:ff:ff:ff