Сбросить настройки сети линукс

How do I completely reset network settings?

When I first installed Ubuntu, all networking worked perfectly. After messing with the settings every so often, it slowly became unusable. I would really like to know if there is a way to completely reset network settings without re-installing Ubuntu, DNS settings, proxy settings, everything. I’m running 12.04.

3 Answers 3

It depends what sort of connection you have and whether you have had to manually tweak some settings for it, as sometimes you need to do in the case of a wireless connection.

If you have a wired connection and have simply been altering the settings with Network Manager, you can unplug your Ethernet cable, go into Network Manager and delete all the wired connections (eth0, autoethernet, etc) and then reboot. This has worked for me before. On restart, your wired network will be detected and automatically configured with DHCP to set up ip addresses and DNS settings. This assumes, however, you have a dynamic ip address: you will still have to specify some settings manually if not.

If you have manually altered any settings such as disabling DNSmasq or manually specifying nameservers by creating a fixed resolv.conf , or even changing firewall settings, then you will need to reverse these first and then remove your connections from network manager and reboot.

If none of these approaches are successful, you may need to login to your router and check the settings there.

Источник

How to Reset Network Interfaces Configuration on Ubuntu Server 18.04?

I have no idea what I’ve done — but it was all working fine, now it’s not, and I cannot for the life of me figure out what is wrong. How can I completely reset the network interfaces? All I want to do is connect to the internet. I can see the server listed in the Router’s Admin screen, with a dynamic IP address that has been generated through the Routers DHCP server. I’ve tried deleting all contents within the /etc/network/interfaces file I’ve tried deleting all YAML files within /etc/netplan, yet whenever I try to run the command netplan apply I keep getting the error «returned non-zero exit status 4» — Whatever that means. I’ve a feeling that something has got screwed up along the way, and I just need to re-set everything then start from the beginning to get the server accessing the internet (outbound). More Details Previously when I had this working I had a static IP for the box on the network, and I could connect to the internet no problem — I’ve no idea what I changed between it working and not working. What was odd though was that when it stopped working I could see the box had 2x MAC addresses listed on the routers admin page, the static IP that I had configured and another MAC address with the server having it’s own Dynamic IP address. All I can assume there is that I’ve plugged in the Ethernet cable into one of the different network ports in the back of the machine. Here are the outputs to the files as requested; lshw -C network

 *-network:0 DISABLED description: Ethernet interface product: I350 Gigabit Network Connection vendor: Intel Corporation physical id: 0 bus info: pci@0000:04:00.0 logical name: enp4s0f0 version: 01 serial: 0c:c4:7a:2a:c8:8a size: 100Mbit/s capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k duplex=full firmware=1.63, 0x80000a05 latency=0 link=no multicast=yes port=twisted pair speed=100Mbit/s resources: irq:43 memory:c7120000-c713ffff ioport:6020(size=32) memory:c7144000-c7147fff memory:90000000-9001ffff memory:90020000-9003ffff *-network:1 DISABLED description: Ethernet interface product: I350 Gigabit Network Connection vendor: Intel Corporation physical id: 0.1 bus info: pci@0000:04:00.1 logical name: enp4s0f1 version: 01 serial: 0c:c4:7a:2a:c8:8b capacity: 1Gbit/s width: 32 bits clock: 33MHz capabilities: pm msi msix pciexpress bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=igb driverversion=5.4.0-k firmware=1.63, 0x80000a05 latency=0 link=no multicast=yes port=twisted pair resources: irq:53 memory:c7100000-c711ffff ioport:6000(size=32) memory:c7140000-c7143fff memory:90040000-9005ffff memory:90060000-9007ffff *-network DISABLED description: Ethernet interface product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:84:00.0 logical name: enp132s0 version: 06 serial: 00:13:3b:11:40:dc size: 10Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s resources: irq:37 ioport:e000(size=256) memory:f2204000-f2204fff memory:f2200000-f2203fff *-network DISABLED description: Ethernet interface product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:85:00.0 logical name: enp133s0 version: 06 serial: 00:13:3b:11:40:dd size: 10Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s resources: irq:37 ioport:d000(size=256) memory:f2104000-f2104fff memory:f2100000-f2103fff 
network: ethernets: enp4s0f0: addresses: [192.168.0.04/24] dhcp4: true gateway4: 192.168.0.1 nameservers: addresses: [8.8.8.8,8.8.4.4] version: 2 

Note: The above IP address, I’m not sure if I typed that (and did a typo when i did, since last time I was trying to get this working the server showed up in the Routers admin with a .104 IP, not a .04 IP — And at the time of writing this, the server isn’t showing up in the Routers admin at all.

cat /etc/network/interfaces # ifupdown has been replaced by netplan(5) on this system. See # /etc/netplan for current configuration. # To re-enable ifupdown on this system, you can run: # sudo apt install ifupdown 
Router's IP Address: 192.168.0.1 Router's Subnet Mask: 255.255.255.0 

Update 2 Ok, so after writing the above update about 5 minutes ago, I think I’ve actually got this working (sometimes all you need is some time to stop working on something then come back to it another day!) So here’s what I did, I simply changed the following file so it looks like this instead; cat /etc/netplan/*.yaml

network: ethernets: enp4s0f0: dhcp4: true version: 2 

Which I can only assume that because the other bits were in there previously, that Netplan thought that the router was configured with a static IP address rather than a dynamic IP address — or getting confused somewhere along the way since the settings look to be telling itself that it is both static (with the ‘addresses’ setting) and dynamic (with the ‘dhcp4’ setting) at the same time. It’d be good to understand exactly why what I have changed actually works — is my assumption above correct? In addition, does the filename of the .yaml file within /etc/netplan/ actually matter? Not really sure where this comes from, since I recall that the filename is different now than what it was previously when I was deleting / recreating the files. BTW — This is just a test system I’m working on — hence why I can safely just delete things, screw it all up, and try and fix it 🙂 Trying to get a much better understanding of the Ubuntu/Linux architecture and playing around at the minute.

Читайте также:  Монтирование iso образа astra linux

Источник

How do I reset the network adapter using a terminal command?

enter image description here

Well ,when I turn the Router off and then I turn it on again while running Ubuntu , it doesn’t obtain an IP address automatically : I click on disconnect , but it remains like above. It works only if I log out and switch to another session and then back the default one. So How do I reset the network adapter using a terminal command, or any another suggestions? Edit: I’ve tried using sudo dhclient , but it didn’t work.

Have you tried disabling/enabling the whole wireless networking through nm? (cannot remember if 11.04 has this feature, though).

Network Manager? It used to allow to disable Networking or Wireless Networking in the menu you obtain clicking on its icon.

4 Answers 4

If you really want to reset the network adapter you usually need to unload and reload the kernel module that it uses.

If you just want to reconfigure it you can usually do:

sudo /etc/init.d/network-manager restart 

But if you just want a new dhcp lease (that’s the technical name for obtain a new IP from the router), you just need to use:

@Binarylife yes, that should get you a new IP address. If it doesnt, the router’s DHCP may be at fault, and not your wifi card.

IMHO this answer will not work, as both mentioned commands refer to listed devices in /etc/network/interfaces. In a normal Ubuntu install, only ‘loopback’ is listed there.

This sound like a network-manager problem to me.

I would try the following: (in a gnome-terminal)

  1. ‘Softblock’ your wireless device with rfkill block wifi
  2. rfkill list will show you if you were successful.
  3. killall nm-applet You kill the network-manager process (panel icon will be gone).
  4. rfkill unblock wifi Enable wifi again.
  5. nm-applet Load a new network-manager session.
Читайте также:  Run make file in linux

Maybe simply killing/loading nm-applet will do. Also note, that you don’t need to use ‘sudo’ for this.

I do know that some router and wifi devices do not ‘like’ each other very well. This is often a problem of a somehow ‘beta’ wifi linux-driver.

nmcli radio wifi off nmcli radio wifi on 

I wrote a script to try various methods to reset the wifi when it dropped the connection or was otherwise non-responsive (it is called every 2 minutes in a cron):

 #!/bin/sh # program to check wifi and reset if not running IPTEST=192.168.1.1 iwconfig=/sbin/iwconfig rfkill=/usr/sbin/rfkill DEVICE=`$iwconfig | egrep 802 | awk ' '` if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # Failed, try to reset wifi - sometimes works ok ( date echo "Apagando wifi. " nmcli nm wifi off sleep 3 echo Iniciando wifi. nmcli nm wifi on sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $iwconfig . " $iwconfig $iwconfig $DEVICE txpower off sleep 3 echo Iniciando wifi. $iwconfig $DEVICE txpower auto fi sleep 10 if ping -c 1 $IPTEST >/dev/null 2>&1 ; then #echo $IPTEST ok exit 0 else # try another way echo "Apagando wifi $rfkill . " $rfkill list $rfkill block wifi sleep 3 echo Iniciando wifi. $rfkill unblock wifi fi #echo Cerrar esta ventana cuando sale el estado #sleep 3 #iftop -i $DEVICE ) >> $HOME/wificheck.log 2>&1 fi exit 0 

Источник

Как сбросить настройки сети?

Ставил nordvpn linux app. Поигрался удалил. Теперь при соединении openvpn в networkmanager, подключение происходит, но нет интернета. До установки этого приложения все было нормально. В какую сторону копать? Какие настройки испортило это приложение?
Убунта 16.04

Читайте также:  Traceroute source ip linux

/etc/NetworkManager/system-connections/ — может тут чего осталось?

/etc/NetworkManager/system-connections/ — может тут чего осталось?

Там только файл с названием моего wifi. Удалять все сохраненные сети и подключаться заново пробовал. Но при подключении openvpn интернета нет.

Мне наверное нужно как то сбросить к дефолту настройки tun0. Не могу понять как это сделать.

Либо зачистить всё конфиги в /etc, относящиеся к nm (это мануалы читать), либо удалить в конфигураторе интерфейс и создать заново.

Либо зачистить всё конфиги в /etc, относящиеся к nm (это мануалы читать), либо удалить в конфигураторе интерфейс и создать заново.

Удалить в конфигураторе интерфейс это как? Подключения все удалял через гуй. Это не то?

То. Должно было сработать. значит какая то хрено в /etc прописалась, придётся искать все пути, откуда nm может что то брать.

Источник

Оцените статью
Adblock
detector