Application to edit .conf files?

Hi guys,

Been having some minor problems with my VPN after getting a new router and private internet access (the company I use) have suggested editing **/etc/resolv.conf by using the command ****sudo nano /etc/resolv.conf but it says command not found for nano. I was in a real hurry this morning so couldn’t check, but is this something I can easily install, or is there another piece of software LEAP uses instead? There was another thing they asked me to type in a while ago to get the software, but LEAP uses zypper so I had to change the command, so wondered if LEAP was similar.

Many thanks**

There are a number of CLI editors to choose from, but nano is simple to use. Install it with

sudo zypper in nano

That’s great, thank you. When I open the file using nano (through the terminal/konsole) does it open a standalone text editor or something? I’ve been asked to edit the file to delete the DNS servers currently in the file and replace with their own ones to see if that sorts my issue.

Cheers!!

It’s a CLI editor, so will open in the terminal. Use it like this

sudo nano /etc/resolv.conf

Thank you. But is it quite obvious as to how to delete sections from the file and then add more text in?

If possible I want to get all prepared for when I try to do this tonight as I’d like to get it done if possible :slight_smile:

Thank you so much!

On Fri 21 Apr 2017 11:46:01 AM CDT, thestig wrote:

Thank you. But is it quite obvious as to how to delete sections from the
file and then add more text in?

If possible I want to get all prepared for when I try to do this tonight
as I’d like to get it done if possible :slight_smile:

Thank you so much!

Hi just add your nameservers and add a # to the current ones;


search some.domain
#nameserver you.cur.ren.t01
#nameserver you.cur.ren.t02
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx

If your using NetworkManager for VPN, then you should be able to just
configure here?


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.2|GNOME 3.22.2|4.4.57-18.3-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

I think there is some confusion here.

You asked for nano, so they told you how to get nano.

Now it seems that you do not know how to use nano.

As your goal is to edit some text file, just use your favorite text editor. Only thing is to use it “as root”. Thus
either, when it is a text editor, from a terminal emulator (like konsole) running as root (directly from the menu or after typing

su -

)
or when it is a GUI editor starting it from the
Main menu > Execute Command > in the field: kdesu kwrite /etc/resolv.conf
or similar for other editors and/or DEs.

Thanks,

It’s not configured with NetworkManager…for some reason it comes up with an error saying it couldn’t start the process, so I use the terminal instead. I’ll give this a go later tonight, hopefully all will be well! I’ll let you know how it goes.

Many thanks

Thank you hcc. I’ll actually try using KWrite. Although I THINK I tried “su kwrite /etc/resolv.conf” earlier and it said it could not connect to display (note, I didn’t use “kdesu”). I’ll try this later. If Kwrite doesn’t work, what other basic editors are there that I can install?

Thanks again :slight_smile:

su kwrite

will not do it as you found out.
Please understand that it is of NO IMPORTANCE which editor you use.
When it “does not work” it is not the editor, but the way you use it that is wrong.

Thank you once again :slight_smile:

I’ll report back later this evening.

Adding nameservers directly to /etc/resolv.conf only works for the current session and won’t survive a reboot.
Follow the instructions in the comments in /etc/resolv.conf to make persistent changes.

But, as mentioned elsewhere,
Assuming you’re using Network Manager, it’s better to configure your DNS servers there instead.

TSU

|[TABLE=“width: 100%”]
|
[TR]
[TD=“width: 100%”]Open a terminal and do the following:

  1. Make a backup of resolv.conf in case it needs to be restored later.

sudo cp /etc/resolv.conf /etc/resolv.bak

  1. Edit existing .conf

sudo nano /etc/resolv.conf

  1. Please remove the listed DNS server(s) and add our DNS servers:

**nameserver 209.222.18.222
**
nameserver 209.222.18.218

Press control-x, and hit y and enter to save and exit nano. Once the changes are made, please try connecting again and check for data flow.

If the configuration reverts when you boot, a starting process is changing the resolv.conf back to it’s original format. This can be prevented by opening Terminal and typing:

chattr +i /etc/resolv.conf​

The file will need to be unlocked for further modification. To revert the immutable attribute, just replace run the same command with -i

chattr -i /etc/resolv.conf​|

[/TD]
[/TR]
[/TABLE]
Does that sound like it should work OK? I will do this, but edit in kwrite.

Cheers

Again, you should use the editor of YOUR choice. What you now show is all sorts of nano commands and manipulation… I never used nano, thus I can not comment on it.

Do you never use a text editor?

Another thing is the problem behind your inability to us an editor.
What s the problem you ty to resolve by editing //etc/resolv.conf. you seem to have an idea what and how to fix something there, but wweedo NOT know what this is and although there are some suggestions on what you could do, IMHO the real problem is undefined here.

Instead of making your system fight with itself by locking your file, you should read the comments in /etc/resolv.conf which says you should instead make some modifications (entering your preferred DNS servers) in /etc/sysconfig/network/config, and then the comments suggest various changes. Or, if you really want to edit /etc/resolv.conf directly, the comments also describe how you can disable automatic config updating.

You can read all this in the /etc/resolv.conf file

cat/resolv.conf

TSU

Well…

I had my VPN set up working absolutely fine, but we got a new router yesterday and since then, as soon as I connect, my internet connection stops working. My web browsers say “resolving host” and then it just fails to connect. I run dual boot and my windows machine (uses the private internet access software) works absolutely fine…so it’s definitely something to do with Linux. When I try to connect it says “initialization sequence completed” which is what it says when it connects correctly to the VPN, yet the internet then stops working. Prior to connecting to the VPN, the internet works absolutely faultlessly.

Thank you once again :slight_smile:

If you want to spend a little more time on this…

You need to back up and describe exactly what error message you’re seeing. We’re all making suggestions based on your original request in your first post which is based on a “suggestion” by your VPN Provider, but… No one really knows why your VPN Provider arrived at this suggestion.

So,
The first thing to know is that if you want to, it’s possible to configure your router to be your VPN beach head (The VPN endpoint) instead of each individual machines in your LAN. I won’t necessarily suggest you do that now, but keep that in mind for the future. It would then mean that all your machines in your LAN (Windows, Linux, etc) would connect “normally” without VPN configurations. But, set that aside for now…

First thing you need to do is provide the reference you’re using to set up your VPN, it should generally either be a downloadable app (Not that common for Linux machines, but common for Windows machines and sometimes Macs)… Or, a “How to” guide for configuring your machine. Might your original setup be based on something like the following?

PIA on 13.2
https://www.privateinternetaccess.com/forum/discussion/17426/install-on-opensuse-13-2

PIA on Fedora (and openSUSE setup would likely be very similar)
https://helpdesk.privateinternetaccess.com/hc/en-us/articles/219660347-OpenVPN-setup-in-Fedora

PIA on Debain/Ubuntu but with some knowledge can be adapted to openSUSE
https://helpdesk.privateinternetaccess.com/hc/en-us/articles/219438247-Installing-OpenVPN-PIA-on-Linux

Additional details you need to provide
Are you managing your networking with Network Manager or Wicked(Classical ifup/ifdown)?
What Desktop are you running?
What VPN protocol are you setting up? OpenVPN is generally recommended, but there are many other possibilities including PPTP (likely how your Windows is set up), L2TP, IKEv2, more.

Lastly, in general, are you trying to set up your VPN to start automatically on boot or manually invoked? (The latter is generally preferred in most cases).

TSU

Hi there and thanks again for taking the time to reply. It’s using NetworkManager to connect, although that cannot seem to start the VPN so I do it via the console every time. The installation was as follows:

  1. sudo apt-get install openvpn
  2. cd /etc/openvpn
  3. sudo wget https://www.privateinternetaccess.com/openvpn/openvpn.zip
  4. sudo unzip openvpn.zip
  5. ls -l
  6. sudo openvpn ‘config-Filename-goes-here.ovpn’

from which you can see I’m using openVPN. I’m running KDE on LEAP 42.2 :slight_smile:

So each time I boot, I open a console and just do

  1. cd /etc/openvpn
  2. sudo openvpn ‘config-Filename-goes-here.ovpn’

This was working absolutely fine until the router change. I had KTorrent running, and that still works after I have activated the VPN, but my internet browser, or YAST software updater etc does not. And as said, my windows machine works fine using their application.

Thank you!

First,
I’d recommend you update your system which should include your installed openvpn and related packages, you can run the following in an elevated console (either su or sudo)

zypper up

After the above command, you can try running your openvpn connection command again.
If you still have problems, you need to do the following

  1. I assume you successfully installed openvpn using apt-get, for instance the following. If you’re not sure, then just run the command again, and if anything was missed, will be installed and if you already have everything, the command will do nothing.
zypper in openvpn NetworkManager-openvpn
  1. Please post the results of “ls -l” to know exactly what was included in your zipped package. It’s possible you will need to do more with those files than just use the ovpn file. You need to navigate your console prompt to the directory containing those extracted files, then rung the command
ls -l

An aside,
If you wanted to configure openVPN in Network Manager, I posted this recently…
https://forums.opensuse.org/showthread.php/521455-Someone-to-help-a-windows-user-VPN-install?p=2804158#post2804158

TSU

Well I edited the file as they suggested and it seems to be working absolutely fine now, even after a reboot :slight_smile:

I used kwrite to edit the file. I have tried using it via networkmanager but it doesn’t seem to work, I got the same issue (“resolving host”) so I’m assuming I’d need to edit the DNS servers again. I set up the VPN using networkmanager by importing the VPN .ovpn file, entering my username and password, but even then networkmanager still asked me for my rootpassword and the VPN password when I tried to log in, so considering networkmanager seems to want to ask for that I’m perfectly happy to run it via the console.

thanks for your help everyone

:slight_smile: