Can't use DNS name instead of ip for jdbc connection on local network
up vote
0
down vote
favorite
I have the following connectionString for my db:
jdbc:sqlserver://{someIpAdress}:1433;database=db
I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.
I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.
Some of the guides I've looked at so far:
https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/
Any help is much appreciated
networking 18.04 dns netplan
add a comment |
up vote
0
down vote
favorite
I have the following connectionString for my db:
jdbc:sqlserver://{someIpAdress}:1433;database=db
I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.
I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.
Some of the guides I've looked at so far:
https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/
Any help is much appreciated
networking 18.04 dns netplan
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have the following connectionString for my db:
jdbc:sqlserver://{someIpAdress}:1433;database=db
I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.
I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.
Some of the guides I've looked at so far:
https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/
Any help is much appreciated
networking 18.04 dns netplan
I have the following connectionString for my db:
jdbc:sqlserver://{someIpAdress}:1433;database=db
I want to resolve someIpAdress to the DNS name instead. By running nslookup on the ip I get the name for that address. But replacing the Ip with the DNS name results in a failing connection for the jdbc connection.
I have tried modifying the file /etc/resolv.conf which now allows me to ping the DNS name, but it seems like the configuration should be done with netplan for Ubuntu 18.04LTS. Changes to interfaces in /etc/network didn't work either.
Some of the guides I've looked at so far:
https://www.cyberciti.biz/faq/howto-set-dns-search-list-for-host-name-lookup/
Any help is much appreciated
networking 18.04 dns netplan
networking 18.04 dns netplan
edited Nov 13 at 10:12
asked Nov 13 at 10:06
Øystein Seel
2121413
2121413
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
But if you don't have DNS server you can edit /etc/hosts
127.0.0.1 localhost
127.0.1.1 com01
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.168.88 lab01
From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.
Hope this help.
I already have that configuration in/etc/hostsand the ln command failed since/etc/resolv.confalready exists
– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure thatresolv.confis linked to path/run/systemd/resolve/resolv.confif you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove/etc/resolv.confin case it already exist and run command to link file again.
– eetsurt
Nov 13 at 11:49
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
But if you don't have DNS server you can edit /etc/hosts
127.0.0.1 localhost
127.0.1.1 com01
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.168.88 lab01
From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.
Hope this help.
I already have that configuration in/etc/hostsand the ln command failed since/etc/resolv.confalready exists
– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure thatresolv.confis linked to path/run/systemd/resolve/resolv.confif you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove/etc/resolv.confin case it already exist and run command to link file again.
– eetsurt
Nov 13 at 11:49
add a comment |
up vote
1
down vote
accepted
If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
But if you don't have DNS server you can edit /etc/hosts
127.0.0.1 localhost
127.0.1.1 com01
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.168.88 lab01
From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.
Hope this help.
I already have that configuration in/etc/hostsand the ln command failed since/etc/resolv.confalready exists
– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure thatresolv.confis linked to path/run/systemd/resolve/resolv.confif you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove/etc/resolv.confin case it already exist and run command to link file again.
– eetsurt
Nov 13 at 11:49
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
But if you don't have DNS server you can edit /etc/hosts
127.0.0.1 localhost
127.0.1.1 com01
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.168.88 lab01
From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.
Hope this help.
If you use 18.04 there is some bug of auto generate resolv.conf file. Create symlink which following command fixs this problem.
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
But if you don't have DNS server you can edit /etc/hosts
127.0.0.1 localhost
127.0.1.1 com01
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.168.88 lab01
From above configuration com01 is your computer name 192.168.168.88 is your server IP address and lab01 is your server name.
Hope this help.
answered Nov 13 at 10:37
eetsurt
113110
113110
I already have that configuration in/etc/hostsand the ln command failed since/etc/resolv.confalready exists
– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure thatresolv.confis linked to path/run/systemd/resolve/resolv.confif you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove/etc/resolv.confin case it already exist and run command to link file again.
– eetsurt
Nov 13 at 11:49
add a comment |
I already have that configuration in/etc/hostsand the ln command failed since/etc/resolv.confalready exists
– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure thatresolv.confis linked to path/run/systemd/resolve/resolv.confif you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove/etc/resolv.confin case it already exist and run command to link file again.
– eetsurt
Nov 13 at 11:49
I already have that configuration in
/etc/hosts and the ln command failed since /etc/resolv.conf already exists– Øystein Seel
Nov 13 at 10:47
I already have that configuration in
/etc/hosts and the ln command failed since /etc/resolv.conf already exists– Øystein Seel
Nov 13 at 10:47
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Your answer tunred out to be correct. I had only provided the IP for the parent DNS, but had to manually add thoose i needed
– Øystein Seel
Nov 13 at 11:41
Just make sure that
resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.– eetsurt
Nov 13 at 11:49
Just make sure that
resolv.conf is linked to path /run/systemd/resolve/resolv.conf if you use 18.04. It's always not getting right DNS if it isn't linked to the path and you can remove /etc/resolv.conf in case it already exist and run command to link file again.– eetsurt
Nov 13 at 11:49
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1092500%2fcant-use-dns-name-instead-of-ip-for-jdbc-connection-on-local-network%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown