请输入手机号码
请输入密码
日本服务器 IP 配置全流程
一 准备与信息获取
二 Linux 静态 IP 配置示例
1) 编辑配置文件(文件名可能因系统不同,如 ifcfg-eth0 或 ifcfg-enp0s3)
vi /etc/sysconfig/network-scripts/ifcfg-eth0
2) 写入示例(将尖括号替换为你的实际参数)
BOOTPROTO=static
DEVICE=eth0
ONBOOT=yes
IPADDR=<公网IP>
NETMASK=<子网掩码>
GATEWAY=<网关地址>
DNS1=8.8.8.8
DNS2=1.1.1.1
3) 使配置生效
systemctl restart NetworkManager 或 systemctl restart network
1) 编辑 YAML(注意缩进)
network:
version: 2
ethernets:
eth0:
dhcp4: no
addresses: [<公网IP>/24]
gateway4: <网关>
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
2) 应用配置
netplan apply
CentOS:
IPV6INIT=yes
IPV6ADDR=<服务器提供的 IPv6>/64
IPV6_DEFAULTGW=
Ubuntu:
ethernets:
eth0:
addresses: [
gateway6:
三 多 IP 与出站源地址控制
ip addr add 203.0.113.10/24 dev eth0 label eth0:0
ip addr add 203.0.113.11/24 dev eth0 label eth0:1
echo "200 ip10" >> /etc/iproute2/rt_tables
ip route add default via <网关> dev eth0 src 203.0.113.10 table ip10
ip rule add from 203.0.113.10 table ip10
ufw allow proto tcp from any to 203.0.113.10 port 80,443
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="203.0.113.10" port port="80" protocol="tcp" accept'
firewall-cmd --reload
四 验证与常见问题处理
ping -c 4 8.8.8.8
ping -c 4 1.1.1.1
curl -I https://www.example.com
ip route get 1.1.1.1 # 核对默认路由与出口网卡
五 合规与安全建议