diff options
Diffstat (limited to 'dhcp_wizard/scripts')
-rw-r--r-- | dhcp_wizard/scripts/Dhcpconf.pm | 8 | ||||
-rw-r--r-- | dhcp_wizard/scripts/dhcpd.conf.default | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm index d94db67d..881ef56f 100644 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ b/dhcp_wizard/scripts/Dhcpconf.pm @@ -73,6 +73,12 @@ sub check_dhcp { sub do_it { my $wiz_domain_name = $o->network_get("DOMAINNAME"); my $wiz_host_name = $o->network_get("HOSTNAME"); + my $wiz_gateway = $o->network_get("GATEWAY"); + my $wiz_dns = $o->network_get("dnsServer"); + if (!$wiz_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/; + } 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(); return $err if $err != 10; @@ -115,12 +121,14 @@ sub do_it { -f $file and MDK::Common::cp_af($file, $file.".orig"); output($file, map { s|__hname__|$wiz_host_name|g; + s|__dns__|$wiz_dns|g; s|__net__|$wiz_ip_net|g; s|__ip__|$wiz_ip_server|g; s|__mask__|$wiz_ip_netmask|g; s|__rng1__|$wiz_ip_range1|g; s|__rng2__|$wiz_ip_range2|g; s|__dname__|$wiz_domain_name|g; + s|__gateway__|$wiz_gateway|g; $_; } cat_ ("__WIZ_HOME__/dhcp_wizard/scripts/dhcpd.conf.default")); standalone::explanations("$file: hname = $wiz_host_name, net = $wiz_ip_net, ip = $wiz_ip_server, diff --git a/dhcp_wizard/scripts/dhcpd.conf.default b/dhcp_wizard/scripts/dhcpd.conf.default index 58e5ab35..ec2e20c2 100644 --- a/dhcp_wizard/scripts/dhcpd.conf.default +++ b/dhcp_wizard/scripts/dhcpd.conf.default @@ -11,13 +11,9 @@ not authoritative; subnet __net__ netmask __mask__{ range __rng1__ __rng2__; option domain-name "__dname__"; - option domain-name-servers __ip__; - option nis-servers __ip__; - option lpr-servers __ip__; - option netbios-name-servers __ip__; - option routers __ip__; + option domain-name-servers __dns__; + option routers __gateway__; option subnet-mask __mask__; - option time-servers __ip__; ddns-updates on; ddns-domainname "__dname__"; ddns-rev-domainname "in-addr.arpa"; |