summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdhcp_wizard/Dhcp.pm18
-rw-r--r--dns_wizard/Bind.pm6
2 files changed, 16 insertions, 8 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 1e26dc5b..d3dbccae 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -29,7 +29,11 @@ use MDK::Wizard::Varspaceval;
use MDK::Wizard::Wizcommon;
my $wiz = new MDK::Wizard::Wizcommon;
+my $interface = 'eth1';
my $wiz_ip_server = $wiz->{net}->itf_get("IPADDR");
+if (!$wiz_ip_server) {
+ ($wiz_ip_server) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+}
my $wiz_tftpserverip = $wiz_ip_server;
my $d = $4 if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
@@ -40,6 +44,7 @@ my $o = {
ip1 => '',
ip2 => '',
pxe => '1',
+ gateway => "$wiz_ip_server",
wiz_authoritative => 0,
einterface => $wiz->{net}->default_itf
},
@@ -64,6 +69,7 @@ $o->{pages} = {
data => [
{ label => N("Lowest IP Address:"), val => \$o->{var}{ip1} },
{ label => N("Highest IP Address:"), val => \$o->{var}{ip2} },
+ { label => N("Gateway IP Address:"), val => \$o->{var}{gateway} },
{ label => N("Enable PXE:"), type => 'bool', val => \$o->{var}{pxe} },
],
next => 'summary'
@@ -106,6 +112,7 @@ $o->{pages} = {
data => [
{ label => N("Lowest IP Address:"), fixed_val => \$o->{var}{ip1} },
{ label => N("Highest IP Address:"), fixed_val => \$o->{var}{ip2} },
+ { label => N("Gateway IP Address:"), fixed_val => \$o->{var}{gateway} },
{ label => N("Interface:"), fixed_val => \$o->{var}{interface} },
{ label => N("Enable PXE:"), fixed_val => \$o->{var}{pxeornot} },
],
@@ -159,16 +166,15 @@ sub check {
sub do_it {
$::testing and return;
- my $wiz_domain_name = $wiz->{net}->network_get("DOMAINNAME");
- my $wiz_host_name = $wiz->{net}->network_get("HOSTNAME");
- my $wiz_gateway = $wiz->{net}->network_get("GATEWAY");
+ my $wiz_domain_name = $wiz->{net}->network_get("DOMAINNAME");
+ my $wiz_host_name = $wiz->{net}->network_get("HOSTNAME");
my $wiz_dns = $wiz->{net}->network_get("dnsServer");
if ($wiz_dns eq '127.0.0.1') {
$wiz_dns = $wiz_ip_server
}
- if (!$wiz_gateway) {
+ if (!$o->{var}{gateway}) {
my $t = `LC_ALL=C /sbin/ip route list scope global`;
- ($wiz_gateway) = $t =~ /default via (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) dev/;
+ ($o->{var}{gateway}) = $t =~ /default via (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) dev/;
}
my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
my $err = check();
@@ -212,7 +218,7 @@ sub do_it {
s|__rng1__|$wiz_ip_range1|g;
s|__rng2__|$wiz_ip_range2|g;
s|__dname__|$wiz_domain_name|g;
- s|__gateway__|$wiz_gateway|g;
+ s|__gateway__|$o->{var}{gateway}|g;
s|__tftpserverip__|$wiz_tftpserverip|g;
$_;
} cat_("__WIZ_HOME__/dhcp_wizard/scripts/dhcpd.conf.default"));
diff --git a/dns_wizard/Bind.pm b/dns_wizard/Bind.pm
index 3dc5a6a7..d99fc8bd 100644
--- a/dns_wizard/Bind.pm
+++ b/dns_wizard/Bind.pm
@@ -37,9 +37,11 @@ my $wiz = new MDK::Wizard::Wizcommon;
my $SERIAL = `date +%d%m20%y`;
my $HOSTNAME = $wiz->{net}->network_get("HOSTNAME");
-#my $IPSERVER = $wiz->{net}->itf_get("IPADDR");
my $interface = 'eth0';
-my ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+my $IPSERVER = $wiz->{net}->itf_get("IPADDR");
+if (!$IPSERVER) {
+ ($IPSERVER) = `/sbin/ip addr show dev $interface` =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/m;
+}
#my $DOMAINNAME = $wiz->{net}->network_get("DOMAINNAME");
my $DOMAINNAME = chomp_(`dnsdomainname`);