(1)
[root@goat webadm]# yum -y install dhcp Loaded plugins: langpacks, presto, refresh-packagekit updates/metalink | 4.6 kB 00:00 updates | 4.7 kB 00:00 updates/primary_db | 5.2 MB 01:23 updates/group_gz | 435 kB 00:09 Resolving Dependencies --> Running transaction check ---> Package dhcp.i686 12:4.2.4-16.P2.fc17 will be installed --> Processing Dependency: dhcp-libs(x86-32) = 12:4.2.4-16.P2.fc17 for package: 12:dhcp-4.2.4-16.P2.fc17.i686 --> Processing Dependency: dhcp-common = 12:4.2.4-16.P2.fc17 for package: 12:dhcp-4.2.4-16.P2.fc17.i686 --> Processing Dependency: libisc-export.so.92 for package: 12:dhcp-4.2.4-16.P2.fc17.i686 --> Processing Dependency: libdns-export.so.95 for package: 12:dhcp-4.2.4-16.P2.fc17.i686 --> Running transaction check ---> Package bind-libs-lite.i686 32:9.9.0-4.fc17 will be updated --> Processing Dependency: libdns-export.so.93 for package: 12:dhclient-4.2.4-0.4.rc1.fc17.i686 --> Processing Dependency: libisc-export.so.90 for package: 12:dhclient-4.2.4-0.4.rc1.fc17.i686 ---> Package bind-libs-lite.i686 32:9.9.2-2.fc17 will be an update --> Processing Dependency: bind-license = 32:9.9.2-2.fc17 for package: 32:bind-libs-lite-9.9.2-2.fc17.i686 ---> Package dhcp-common.i686 12:4.2.4-0.4.rc1.fc17 will be updated ---> Package dhcp-common.i686 12:4.2.4-16.P2.fc17 will be an update ---> Package dhcp-libs.i686 12:4.2.4-0.4.rc1.fc17 will be updated ---> Package dhcp-libs.i686 12:4.2.4-16.P2.fc17 will be an update --> Running transaction check ---> Package bind-license.noarch 32:9.9.0-4.fc17 will be updated --> Processing Dependency: bind-license = 32:9.9.0-4.fc17 for package: 32:bind-libs-9.9.0-4.fc17.i686 ---> Package bind-license.noarch 32:9.9.2-2.fc17 will be an update ---> Package dhclient.i686 12:4.2.4-0.4.rc1.fc17 will be updated ---> Package dhclient.i686 12:4.2.4-16.P2.fc17 will be an update --> Running transaction check ---> Package bind-libs.i686 32:9.9.0-4.fc17 will be updated --> Processing Dependency: libdns.so.93 for package: 32:bind-utils-9.9.0-4.fc17.i686 --> Processing Dependency: libisc.so.90 for package: 32:bind-utils-9.9.0-4.fc17.i686 ---> Package bind-libs.i686 32:9.9.2-2.fc17 will be an update --> Running transaction check ---> Package bind-utils.i686 32:9.9.0-4.fc17 will be updated ---> Package bind-utils.i686 32:9.9.2-2.fc17 will be an update --> Finished Dependency Resolution
Dependencies Resolved
================================================================================ Package Arch Version Repository Size ================================================================================ Installing: dhcp i686 12:4.2.4-16.P2.fc17 updates 491 k Updating for dependencies: bind-libs i686 32:9.9.2-2.fc17 updates 894 k bind-libs-lite i686 32:9.9.2-2.fc17 updates 633 k bind-license noarch 32:9.9.2-2.fc17 updates 74 k bind-utils i686 32:9.9.2-2.fc17 updates 183 k dhclient i686 12:4.2.4-16.P2.fc17 updates 263 k dhcp-common i686 12:4.2.4-16.P2.fc17 updates 164 k dhcp-libs i686 12:4.2.4-16.P2.fc17 updates 131 k
Transaction Summary ================================================================================ Install 1 Package Upgrade ( 7 Dependent packages)
Total download size: 2.8 M Downloading Packages: Setting up and reading Presto delta metadata updates/prestodelta | 975 kB 00:15 Processing delta metadata Download delta size: 882 k (1/6): bind-libs-9.9.0-4.fc17_9.9.2-2.fc17.i686.drpm | 306 kB 00:07 (2/6): bind-libs-lite-9.9.0-4.fc17_9.9.2-2.fc17.i686.drp | 226 kB 00:03 (3/6): bind-license-9.9.0-4.fc17_9.9.2-2.fc17.noarch.drp | 70 kB 00:01 (4/6): dhclient-4.2.4-0.4.rc1.fc17_4.2.4-16.P2.fc17.i686 | 111 kB 00:02 (5/6): dhcp-common-4.2.4-0.4.rc1.fc17_4.2.4-16.P2.fc17.i | 98 kB 00:03 (6/6): dhcp-libs-4.2.4-0.4.rc1.fc17_4.2.4-16.P2.fc17.i68 | 70 kB 00:01 Finishing rebuild of rpms, from deltarpms <locally rebuilding deltarpms> | 2.1 MB 00:01 Presto reduced the update size by 60% (from 2.1 M to 882 k). Package(s) data still to download: 183 k (1/2): bind-utils-9.9.2-2.fc17.i686.rpm | 183 kB 00:05 警告:rpmts_HdrFromFdno: 表頭 V3 RSA/SHA256 Signature, key ID 1aca3465: NOKEY Public key for bind-utils-9.9.2-2.fc17.i686.rpm is not installed (2/2): dhcp-4.2.4-16.P2.fc17.i686.rpm | 491 kB 00:13 -------------------------------------------------------------------------------- Total 34 kB/s | 674 kB 00:20 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 Importing GPG key 0x1ACA3465: Userid : "Fedora (17) <fedora@fedoraproject.org>" Fingerprint: cac4 3fb7 74a4 a673 d81c 5de7 50e9 4c99 1aca 3465 Package : fedora-release-17-1.noarch (@anaconda-0) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-i386 Running Transaction Check Running Transaction Test Transaction Test Succeeded Running Transaction Updating : 12:dhcp-libs-4.2.4-16.P2.fc17.i686 1/15 Updating : 12:dhcp-common-4.2.4-16.P2.fc17.i686 2/15 Updating : 32:bind-license-9.9.2-2.fc17.noarch 3/15 Updating : 32:bind-libs-lite-9.9.2-2.fc17.i686 4/15 Updating : 32:bind-libs-9.9.2-2.fc17.i686 5/15 Installing : 12:dhcp-4.2.4-16.P2.fc17.i686 6/15 Updating : 12:dhclient-4.2.4-16.P2.fc17.i686 7/15 Updating : 32:bind-utils-9.9.2-2.fc17.i686 8/15 Cleanup : 12:dhclient-4.2.4-0.4.rc1.fc17.i686 9/15 Cleanup : 12:dhcp-common-4.2.4-0.4.rc1.fc17.i686 10/15 Cleanup : 32:bind-libs-lite-9.9.0-4.fc17.i686 11/15 Cleanup : 32:bind-utils-9.9.0-4.fc17.i686 12/15 Cleanup : 32:bind-libs-9.9.0-4.fc17.i686 13/15 Cleanup : 32:bind-license-9.9.0-4.fc17.noarch 14/15 Cleanup : 12:dhcp-libs-4.2.4-0.4.rc1.fc17.i686 15/15 Verifying : 32:bind-license-9.9.2-2.fc17.noarch 1/15 Verifying : 32:bind-utils-9.9.2-2.fc17.i686 2/15 Verifying : 12:dhcp-common-4.2.4-16.P2.fc17.i686 3/15 Verifying : 32:bind-libs-9.9.2-2.fc17.i686 4/15 Verifying : 12:dhcp-4.2.4-16.P2.fc17.i686 5/15 Verifying : 32:bind-libs-lite-9.9.2-2.fc17.i686 6/15 Verifying : 12:dhcp-libs-4.2.4-16.P2.fc17.i686 7/15 Verifying : 12:dhclient-4.2.4-16.P2.fc17.i686 8/15 Verifying : 32:bind-utils-9.9.0-4.fc17.i686 9/15 Verifying : 32:bind-libs-lite-9.9.0-4.fc17.i686 10/15 Verifying : 12:dhcp-libs-4.2.4-0.4.rc1.fc17.i686 11/15 Verifying : 12:dhclient-4.2.4-0.4.rc1.fc17.i686 12/15 Verifying : 12:dhcp-common-4.2.4-0.4.rc1.fc17.i686 13/15 Verifying : 32:bind-license-9.9.0-4.fc17.noarch 14/15 Verifying : 32:bind-libs-9.9.0-4.fc17.i686 15/15
Installed: dhcp.i686 12:4.2.4-16.P2.fc17
Dependency Updated: bind-libs.i686 32:9.9.2-2.fc17 bind-libs-lite.i686 32:9.9.2-2.fc17 bind-license.noarch 32:9.9.2-2.fc17 bind-utils.i686 32:9.9.2-2.fc17 dhclient.i686 12:4.2.4-16.P2.fc17 dhcp-common.i686 12:4.2.4-16.P2.fc17 dhcp-libs.i686 12:4.2.4-16.P2.fc17
Complete! [root@goat webadm]#
(2) [root@goat webadm]# vi /etc/dhcp/dhcpd.conf
[root@goat webadm]# cat /etc/dhcp/dhcpd.conf # # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.sample # see dhcpd.conf(5) man page # option domain-name "lang.kmvs.km.edu.tw";
option domain-name-servers dns.kmvs.km.edu.tw; default-lease-time 600; max-lease-time 7200;
authoritative;
subnet 10.1.1.0 netmask 255.255.255.0 { range dynamic-bootp 10.1.1.200 10.1.1.254; option broadcast-address 10.1.1.255; option routers 10.1.1.254; } [root@goat webadm]#
(3) [root@goat webadm]# systemctl start dhcpd.service [root@goat webadm]# systemctl enable dhcpd.service ln -s '/usr/lib/systemd/system/dhcpd.service' '/etc/systemd/system/multi-user.target.wants/dhcpd.service' [root@goat webadm]#
(4) [root@goat webadm]# ps ax|grep dhcp 823 ? S 0:00 /sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address 192.168.122.1 --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases --dhcp-lease-max=253 --dhcp-no-override 869 ? S 0:00 /sbin/dhclient -d -4 -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-em1.pid -lf /var/lib/dhclient/dhclient-a22a25e5-b499-4ebb-b74f-9a40d150dab0-em1.lease -cf /var/run/nm-dhclient-em1.conf em1 2385 ? Sl 0:03 gedit /run/media/webadm/FLASH DRIVE/20120830dhcpd_setup.txt 2610 ? S 0:00 /sbin/dhclient -d -4 -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-p33p1.pid -lf /var/lib/dhclient/dhclient-343e529b-d34f-43c1-879c-6222ef9d73b8-p33p1.lease -cf /var/run/nm-dhclient-p33p1.conf p33p1 2613 pts/0 S+ 0:00 grep --color=auto dhcp [root@goat webadm]# ps ax|grep dhcpd 2385 ? Sl 0:03 gedit /run/media/webadm/FLASH DRIVE/20120830dhcpd_setup.txt 2615 pts/0 S+ 0:00 grep --color=auto dhcpd [root@goat webadm]#
[root@goat webadm]# /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.2.4-P2 Copyright 2004-2012 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file Wrote 0 leases to leases file.
No subnet declaration for virbr0 (192.168.122.1). ** Ignoring requests on virbr0. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface virbr0 is attached. **
No subnet declaration for em1 (10.2.2.101). ** Ignoring requests on em1. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface em1 is attached. **
No subnet declaration for p33p1 (no IPv4 addresses). ** Ignoring requests on p33p1. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface p33p1 is attached. **
Not configured to listen on any interfaces!
This version of ISC DHCP is based on the release available on ftp.isc.org. Features have been added and other changes have been made to the base software release in order to make it work better with this distribution.
Please report for this software via the Red Hat Bugzilla site: http://bugzilla.redhat.com
exiting. [root@goat webadm]#
[root@goat webadm]# system-config-network-tui
[root@goat webadm]# vi /etc/sysconfig/selinux [root@goat webadm]# cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. # SELINUX=enforcing SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
[root@goat webadm]# vi /etc/default/grub [root@goat webadm]# cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="Fedora" GRUB_DEFAULT=saved GRUB_CMDLINE_LINUX="rd.md=0 rd.dm=0 LANG=zh_TW.UTF-8 KEYTABLE=us rd.lvm.lv=vg_goat/lv_root SYSFONT=False rd.luks=0 rd.lvm.lv=vg_goat/lv_swap rhgb quiet biosdevname=0" #GRUB_THEME="/boot/grub2/themes/system/theme.txt" [root@goat webadm]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.3.4-5.fc17.i686.PAE Found initrd image: /boot/initramfs-3.3.4-5.fc17.i686.PAE.img done [root@goat webadm]# cd /etc/sysconfig/network-scripts/ [root@goat network-scripts]# ls ifcfg-em1 ifdown ifdown-ippp ifdown-post ifdown-sit ifup-aliases ifup-ippp ifup-isdn ifup-post ifup-sit init.ipv6-global network-functions-ipv6 ifcfg-eth2 ifdown-bnep ifdown-ipv6 ifdown-ppp ifdown-tunnel ifup-bnep ifup-ipv6 ifup-plip ifup-ppp ifup-tunnel net.hotplug ifcfg-lo ifdown-eth ifdown-isdn ifdown-routes ifup ifup-eth ifup-ipx ifup-plusb ifup-routes ifup-wireless network-functions [root@goat network-scripts]# cat ifcfg-p255p1 cat: ifcfg-p255p1: 沒有此一檔案或目錄 [root@goat network-scripts]# cat ifcfg-em1 UUID="a22a25e5-b499-4ebb-b74f-9a40d150dab0" NM_CONTROLLED=yes HWADDR=30:85:a9:a5:67:a1 BOOTPROTO=none DEVICE=em1 ONBOOT=yes IPADDR=10.2.2.101 NETMASK=255.255.255.0 TYPE=Ethernet GATEWAY=10.2.2.254 DNS1=168.95.1.1 IPV6INIT=no USERCTL=no PREFIX=24 [root@goat network-scripts]# mv ifcfg-em1 ifcfg-eth0 [root@goat network-scripts]# reboot
[root@nat1 ~]# cat ./startnat iptables -F echo "1" /proc/sys/net/ipv4/ip_forward modprobe ip_nat_ftp modprobe ip_nat_irc modprobe ip_conntrack_ftp modprobe ip_conntrack_irc
iptables -t nat -A POSTROUTING -o eth0 -s 10.1.1.0/24 -j MASQUERADE
[root@goat webadm]# /usr/sbin/dhcpd Internet Systems Consortium DHCP Server 4.2.4-P2 Copyright 2004-2012 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file Wrote 0 leases to leases file.
No subnet declaration for virbr0 (192.168.122.1). ** Ignoring requests on virbr0. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface virbr0 is attached. **
No subnet declaration for eth1 (163.25.20.63). ** Ignoring requests on eth1. If this is not what you want, please write a subnet declaration in your dhcpd.conf file for the network segment to which interface eth1 is attached. **
Listening on LPF/eth0/00:0e:2e:f0:c3:0e/10.1.1.0/24 Sending on LPF/eth0/00:0e:2e:f0:c3:0e/10.1.1.0/24 Sending on Socket/fallback/fallback-net [root@goat webadm]#
|