my $filename = "/etc/sysconfig/network-scripts/ifcfg-$d->{name}";
my $routefile = "/etc/sysconfig/network-scripts/route-$d->{name}";
+ my $route6file = "/etc/sysconfig/network-scripts/route6-$d->{name}";
my $routes = '';
+ my $routes6 = '';
my $header = "DEVICE=$d->{name}\nONBOOT=yes\n";
my $data = '';
$data .= "GATEWAY=$d->{gw}\n";
if (!PVE::Network::is_ip_in_cidr($d->{gw}, $d->{ip}, 4)) {
$routes .= "$d->{gw} dev $d->{name}\n";
- $routes .= "default via $d->{gw}\n";
+ $routes .= "default via $d->{gw} dev $d->{name}\n";
}
}
}
} else {
$data .= "IPV6ADDR=$d->{ip6}\n";
if (defined($d->{gw6})) {
- $data .= "IPV6_DEFAULTGW=$d->{gw6}\n";
if (!PVE::Network::is_ip_in_cidr($d->{gw6}, $d->{ip6}, 6) &&
!PVE::Network::is_ip_in_cidr($d->{gw6}, 'fe80::/10', 6)) {
- $routes .= "$d->{gw6} dev $d->{name}\n";
- $routes .= "default via $d->{gw6}\n";
+ $routes6 .= "$d->{gw6} dev $d->{name}\n";
+ $routes6 .= "default via $d->{gw6} dev $d->{name}\n";
+ } else {
+ $data .= "IPV6_DEFAULTGW=$d->{gw6}\n";
}
}
}
$header .= "BOOTPROTO=$bootproto\n";
$self->ct_file_set_contents($filename, $header . $data);
$self->ct_modify_file($routefile, $routes, delete => 1, prepend => 1);
+ $self->ct_modify_file($route6file, $routes6, delete => 1, prepend => 1);
}
my $sysconfig_network = "/etc/sysconfig/network";
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/route-eth0
+ /etc/sysconfig/network-scripts/route6-eth0
/etc/sysconfig/network-scripts/ifcfg-eth1
/etc/sysconfig/network-scripts/route-eth1
+ /etc/sysconfig/network-scripts/route6-eth1
/etc/sysconfig/network-scripts/ifcfg-eth2
/etc/sysconfig/network-scripts/route-eth2
+ /etc/sysconfig/network-scripts/route6-eth2
/etc/sysconfig/network-scripts/ifcfg-eth3
/etc/sysconfig/network-scripts/route-eth3
+ /etc/sysconfig/network-scripts/route6-eth3
/etc/sysconfig/network/ifcfg-eth0
/etc/sysconfig/network/ifroute-eth0
/etc/sysconfig/network/ifcfg-eth1