Monday, June 14, 2021
Now that we have a static IP setup for our network. We want to use it as a DNS server. Let's go over the steps again for configuring a DNS server and make sure that eveything works with the static IP. The key is the make it work on reboot.
Before you do anything get the name of you network adaptor and the IP address for it, my network adapter is enp0s3 and my IP address is 192.168.0.14. Yours will be different
You also want to know the hostname of the server for the configuration, you can find out what the hostname is by typing hostname
If you want to change your hostname you can follow the instructions on this post
Make sure you have the following information in the /etc/named.conf file
We are making sure the configurations are correct and test out our static IP settings. If you want to learn how to create a DNS server from scratch you can follow the post here. Make sure the forward.dc file has the following contents
$TTL 86400
@ IN SOA masterdns.acmebanking.com. root.acmebanking.coml. (
772125207 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS masterdns.acmebanking.com.
@ IN A 192.168.0.14
masterdns IN A 192.168.0.14
apps IN A 192.168.0.15
nets IN A 192.168.0.16
and the reverse.dc file has the following contents
$TTL 86400
@ IN SOA masterdns.acmebanking.com. root.acmebanking.com. (
28259135 ;Serial
3600 ;Refresh
1800 ;Retry
604800 ;Expire
86400 ;Minimum TTL
)
@ IN NS masterdns.acmebanking.com.
@ IN PTR dc.acmebanking.com.
masterdns IN A 192.168.0.14
14 IN PTR masterdns.acmebanking.com.
15 IN PTR apps.acmebanking.com.
16 IN PTR nets.acmebanking.com.
4. Now that we've configured our DNS server, we are ready to enable and restart it. Type in the following commands into the terminal server
systemctl start named
systemctl enable named
5. Now we want to disable the firewall because we want to test our DNS server, this is just for testing to make sure eveything is working correctly. In production you would want to create a rule on your firewall to allow port 53 for DNS server. Type in the following to disable the firewall
systemctl stop firewalld
systemctl disable firewalld
6. If you are using SELinux you want to configure the permission and ownership for the named directory and named.conf file
Type in the following commands if you have SELinux
7. Linux has a very useful command to check that there's no syntax error in the configuration files before we bring everything up. First lets check the configuration in the named.conf file with this command
named-checkconf /etc/named.conf
if the command prompt is returned that means your configuration is good. Now let's check the zone files with the following commands
named-checkzone acmebanking.com /var/named/forward.dc
named-checkzone acmebanking.com /var/named/reverse.dc
If you get the OK response that means your zone files are configured correctly
8. Since our named configuration files are correct we are now ready to the add the DNS to our network adapter. In the beginning of the post we got the network adapter's name with the ifconfig command it's enp0s3 each network adapter in Linux has it's own configuration. First we want to navigate to the network configuration directory with this command
cd /etc/sysconfig/network-scripts/ then you want to edit the adapter file with the following command
vi ifcfg-enp0s3 at the end of the file you want to add the DNS IP to it like this. Then press esc then :wq! to save the file.
9. Restart the network with the following command
systemctl restart NetworkManager.service
10. Now you want to edit the name server setting so that the network adapter resolves to the DNS server instead of the default gateway. Edit the resovl.conf file with the command vi /etc/resolv.conf and add the filing line nameserver 192.168.0.14 type esc then :wq! to save the file
11. We are now ready to test the DNS, type in the following command to see the settings for the DNS
dig masterdns.acmebanking.com
If configured correctly you should see that the DNS server is now resolving to the IP address of our network adapter.
12. You can do the same for the apps.acmebanking.com and nets.acmebanking.com clients witht eh following commands nsloopup apps.acmebanking.com and nslookup nets.acmebanking.com or the reverse lookup with nslookup 192.168.0.14 or nslookup 192.168.0.16
In most situations you would want a static IP with your DNS server so that you don't have the change resolv.conf file everytime the network starts. So we want to prevent the changes to the file /etc/resolv.conf once the DNS server has been added so that it will persist, type the command chattr +i /etc/resovl.conf to make that happen.
Subscribe to:
Post Comments (Atom)
Search This Blog
Tags
Web Development
Linux
Javascript
DATA
CentOS
ASPNET
SQL Server
Cloud Computing
ASP.NET Core
ASP.NET MVC
SQL
Virtualization
AWS
Database
ADO.NET
AngularJS
C#
CSS
EC2
Iaas
System Administrator
Azure
Computer Programming
JQuery
Coding
ASP.NET MVC 5
Entity Framework Core
Web Design
Infrastructure
Networking
Visual Studio
Errors
T-SQL
Ubuntu
Stored Procedures
ACME Bank
Bootstrap
Computer Networking
Entity Framework
Load Balancer
MongoDB
NoSQL
Node.js
Oracle
VirtualBox
Container
Docker
Fedora
Java
Source Control
git
ExpressJS
MySQL
NuGet
Blogger
Blogging
Bower.js
Data Science
JSON
JavaEE
Web Api
DBMS
DevOps
HTML5
MVC
SPA
Storage
github
AJAX
Big Data
Design Pattern
Eclipse IDE
Elastic IP
GIMP
Graphics Design
Heroku
Linux Mint
Postman
R
SSL
Security
Visual Studio Code
ASP.NET MVC 4
CLI
Linux Commands
Powershell
Python
Server
Software Development
Subnets
Telerik
VPC
Windows Server 2016
angular-seed
font-awesome
log4net
servlets
tomcat
AWS CloudWatch
Active Directory
Angular
Blockchain
Collections
Compatibility
Cryptocurrency
DIgital Life
DNS
Downloads
Google Blogger
Google Chrome
Google Fonts
Hadoop
IAM
KnockoutJS
LINQ
Linux Performance
Logging
Mobile-First
Open Source
Prototype
R Programming
Responsive
Route 53
S3
SELinux
Software
Unix
View
Web Forms
WildFly
XML
cshtml
githu
I love this article please visit nike running shoes for flat feet
ReplyDelete