Restart networking oracle linux

How To Start, Stop, Restart Networking On Linux?

I have changed my network configuration and want to restart to make changes effective. Or there are some problems with my network and I think restarting it will solve my problems. Here we will look at how to restart networking service in various network distributions like Ubuntu, Debian, Fedora, CentOS.

Get Status Of Network Service

We will get status of network with the following command.

Debian, Ubuntu, Kali

For deb based distributions we will use init.d system. We will provide status option to the networking script.

As we cab see that networking service is active from given date. Its PID is 897 .

Fedora, CentOS

For distributions like CentOS, RedHat, Fedora we will use systemctl command. We will provide the options status and network which is the networking service.

Stop Network Service

We can stop network like below. Bu keep in mind for remote connection it can be create problems with ssh

Ubuntu, Debian, Kali

We will use stop option with networking command in order to stop network services in Ubuntu, Debian, Kali, Mint etc.

Fedora,CentOS

We will use systemctl again with stop option which will stop network services. We also require root privileges that will beget with sudo command.

Start Network

We can start network like below.

Ubuntu, Debian, Kali

We will provide start option in order to start network services in deb based distributions.

Fedora,CentOS

We will use start network option in order to start network services in rpm based distributions.

Restart Network

Now we can restart our network or network services.

Источник

Настройка сети в Oracle Linux

В данном посте будет рассказано про базовую настройку сети в операционных сетях на базе ОС Linux. Будут рассмотрены следующие вопросы:

  • Файлы, в которых прописываются сетевые настройки
  • Настройка сети на примере – связь двух виртуальных машин

В Oracle Enterprise Linux есть несколько способов настройки сети. Она производится либо через пользовательские интерфейсы, которые записывают введенные значения в необходимые конфигурационные файлы либо изменения можно вносить напрямую в необходимые конфигурационные файлы. После внесения любых изменений в файл необходимо перезагрузить ОС, либо перезапустить сервис сети (см. ниже), либо отключить сетевой интерфейс, а затем снова включить его, чтобы изменения вступили в силу. В большинстве систем Linux для этой цели можно использовать команды ifdown интерфейс или ifup интерфейс (см. ниже). Все настройки и файлы, описанные ниже, актуальны для операционной системы Oracle Linux 7.

Файлы, в которых прописываются сетевые настройки

Для начала рассмотрим файл /etc/sysconfig/network. В нем описываются сетевые настройки, касающиеся сетевого имени хоста и шлюза по умолчанию. Сетевое имя хоста прописывается в HOSTNAME, шлюз по умолчанию – в GATEWAY. Редактирование всех сетевых файлов должно осуществляться с привилегированными полномочиями (root или sudo).

Другой важный файл – /etc/sysconfig/network-scripts/ifcfg-интерфейс. В нем прописываются сетевые настройки для адаптера интерфейс (например, ifcfg-enp0s3). В случае, если в системе используется несколько сетевых адаптеров, стоит ожидать дополнительные конфигурационные файлы, для каждого из адаптеров (enp0s4, где en – ethernet, p – номер шины, s – номер слота. Такая наименование действительно для PCI-устройств). Ниже приведен пример конфигурации адаптера ifcfg-enp0s3, использующим DHCP.

Читайте также:  Windows file server firewall

Далее пример конфигурации адаптера ifcfg-enp0s3 со статическим IP-адресом. Для того, чтобы настроить адаптер ifcfg-enp0s3 для работы со статическим IP-адресом, надо с помощью текстового редактора (например, nano или vi) изменить файл /etc/sysconfig/network-scripts/ifcfg-enp0s3. А именно, добавить строки с указанием нужного IP-адреса, маски подсети, шлюза и DNS (IPADDR, PREFIX, GATEWAY, DNS1). Также, необходимо изменить значение параметра BOOTPROTO с dhcp на none. Параметр BOOTPROTO отвечает за то, как интерфейс получит IP-адрес.

Файл /etc/hosts содержит информацию, помогающую при локальном преобразовании имен.

В файле /etc/resolv.conf находится расположение DNS сервера(ов) для преобразования имен.

После всех настроек, необходимо перезапустить интерфейс, чтобы изменения вступили в силу. Делаем это командами ifdown и ifup.

Альтернативный вариант – перезапуск сервиса сети, отвечающего за сеть:

Далее проверяем новые настройки сети командой ifconfig. Команда выведет на экран несколько интерфейсов, нас интересует только лишь наш enp0s3.

Настройка сети на примере – связь двух виртуальных машин

Далее, настроим сетевое соединение между двумя виртуальными машинами. Для этого необходимо проделать вышеописанные настройки сетевых интерфейсов на двух виртуальных машинах, распределив между ними IP-адреса и маски подсети так, чтобы они оказались в одной логической подсети.

После того, как адресация и интерфейсы машин в ОС настроены, перейдем к настройке непосредственного соединения виртуальных машин через интерфейс гипервизора – в нашем случае, используя настройки Virtual Box.

Как видно по скриншотам ниже, надо переключить тип соединения в режим “Сетевой мост”. Сделав это в настройках обеих машин, они получат возможность увидеть друг друга в сети.

Изменение типа подключения с NAT на Сетевой мост для первой машины.

Изменение типа подключения с NAT на Сетевой мост для второй машины.

Проверка сетевых настроек командой ifconfig.

Проверка связи командой ping. Обе машины видят друг друга в локальной сети.

Источник

Oracle Enterprise Linux 6.x networking

Lately I got many questions regarding the network configuration of Oracle Enterprise Linux 6 (Red Hat Enterprise Linux 6).
Enough to write a little article about it.

It seems that some of the network configuration was altered in OEL6. The reason as far as I know is the implementation of the NetworkManager daemon. I don’t know why they are using CamelCase for the daemon name, but mind that. Even though the NetworkManager should make the configuration as painless as possible (at least thats what the manual page said), it seems to actually make the configuration more of a pain for some.

Below I will cover some topics in an effort to get you going and remove the pain 🙂

Configuring eth0 for manual operation

  • Step 1: disable the NetworkManager daemon
  • Step 2: remove the NetworkManager from Init (start-up)
  • Step 3: open the ifcfg-eth0 config file (alter the suffix ‘eth0’ to match the adapter of your choice)
  • Step 4: Alter the following to match your environment…
  • Step 5: Write/close the configuration file (:wq in vi)
  • Step 6: Restart the network service
  • TIP 0: Obviously match the configuration above to match your home network.
  • TIP 1: NetworkManager is not always present in which case you can obviously skip step 1 – 2.
  • TIP 2: There are reports that NETMASK=xxx.xxx.xxx.xxx is actually more stable then PREFIX=xx notation.
    My advice, use NETMASK= which is also better understood by non networking guys.
  • TIP 3: Not sure about the correct NETWORK, NETMASK, BROADCAST or PREFIX settings, give ipcalc a try:

Configuring DNS

DNS always seems to be a bugger and a hard one to understand. Do note that DNS is JUST A IP PHONEBOOK. Nothing fancy there. Also there are various ways of configuring DNS. One way is by adding the DNS configuration in the ifcfg-suffix configuration file with the DNS1=ip.ip.ip.ip DNS2=ip.ip.ip.ip keywords. As an effect, the networking service will update the appropriate configuration files. To be frank, I find this to be confusing and do not like duplicate configurations everywhere in my -has to be clean- environment. My advice is to configure the DNS is the appropriate files directly like this…

  • Step 1: Edit the resolve.conf where DNS is configured.
  • Step 2: Add or Alter the following to match your environment
  • Step 3: Test to see if name resolution works
  • TIP 1: Linux actually tries to find the ip in the /etc/hosts file first. If you know the hostnamename and FQDN to an certain IP and it can be classified as static. Consider using the hostsfile instead of a centralized DNS. This will boost performance if the name is resolved often. If multiple systems use and depend on a machine reference, use centralized DNS in order to lighten the administrative tasks.
  • TIP 2: Experiencing slow log on times or slow application performance? A faulty DNS configuration might just be the cause. A quick way to test this is by temp. disabling DNS all together. This can be done by editing the /etc/nsswitch.conf file.
    • alter the line
    • to the line
    • write the file and test if the performance has improved.
  • The reason for this is that DNS is often used to register user logon or session information based on the visitors IP address. Examples are the ssh daemon, ftp servers, webservers, linux logon, etc.
Читайте также:  Как запустить команду выполнить windows 10

STATIC ROUTES

In some case you want linux to use alternative routes to access certain Linux resources. The way to go in these cases are creating routes. In most cases you want these to be presistant in which case ‘route add –‘ wont suffice. In our example we will create two new routes. On describing a route to a specific host, the other describing the route to a specific network. Alter the example to match your needs.

  • STEP 1: Create a new file called static-routes in the /etc/sysconfig/ directory
  • STEP 2: Add the following, obviously matching your specific needs
  • STEP 3: Restart the network service
  • TIP 1: SIOCADDRT: No such process means the designated gateway doesnt exsist on any known interface. (typo?)
  • TIP 2: view the route information usint the route command
  • TIP 3: use the ipcalc –prefix command to determin the right /prefix for your environment.
  • TIP 4: In older environments the ifup-routes is used, this shscript still exsists in the /etc/sysconfig/network-scripts/ifup-routes

Locate my mac address

The ifcfg-eth# config allows you to configure the specific mac address to guarantee the IP is bound to the right adapter. In virtualized environments this might save you a lot of trouble in the situation where the virtualized domain is altered. On the other hand it might cause trouble when the staticly configured MAC is migrated in virtual environments. Either case, you might want to know the MAC linux sees belonging to an certain adapter. You can find the MAC address in the following location:

Obviously you need to alter eth0 in the path to match the adapter you are looking for. Not sure? The change directory to /sys/class/net and perform a list to see all discovered and registered adapters.

IPTables (Linux firewall)

By default IPtables (which is the linux firewall) is enabled. You can view the running configuration by checking the service status like this.

You can simply turn the firewall off by modifying and applying steps 1-2 of the first configuring eth0 instruction. This will reduce the security of your linux platform significantly. My advice, add the ports you need for your services and let IPtables protect you. The easiest way is by simply editing the iptables configuration file.

Adding a port is as easy as copy/pasting the always present firewall rule that allowes port 22 (ssh). Copy past it and alter the -p (protocol) -dport (destination port) to match your needs. For example, allowing HTTP/HTTPS.

afterward restart iptables

TIP: If you are experimenting with IPv6 (then your Instant COOL!), mind that the ipv6 firewall is called ip6tables and the configuration is called the same. The basic iptables doesnt handle ipv6 at all.

TIP: If you are using ipv6 code your IPv4 ip to ease administration. Example:

Additional questions?

Just post it below and maybe ill respond in due time 🙂

Источник

Restarting, Starting, Stopping, Checking the Status of the Network Service in Linux

In Linux-based operating systems, information about network operations such as network settings, network commands or network configuration is included. In Linux operating systems, as everything is a file, network settings are also kept in files. The settings can be edited with any text editor or by various tools.

Network settings are located in the following files and directories.

Each of the settings files is used for different operations. The files in the network-scripts directory are used for network settings. Network settings are eth0, eth1, etc. according to the network card in files starting with ifcfg. kept by names.

Inside the network settings;

It also has various settings such as MAC address, Network type. When you want to get IP using DHCP , it will be sufficient to write the DEVICE, BOOTPROTO and ONBOOT settings.

Network Operations

In Linux systems, we can use the following commands to examine the Stop, Start, Restart and Status of our Network services.

Stop Network Service

You can stop the network service as follows. Check before stopping the service. There will be a problem with your connection. We recommend that you try it in your test environment.

Ubuntu, Debian, Kali and Mint

Ubuntu, Debian, Kali, Mint etc. We will use the networking stop command to service networking stop.

Источник

Restart networking oracle linux

You can start and stop the database manually, set it to automatically after the system shuts down and starts, or using Enterprise Manager.

Shutting Down and Starting Up Using the Configuration Services Script

Execute these commands as root using sudo .

You can start and stop the database using the /etc/init.d/oracle-xe-18c script.

Run the following command to start the listener and database:

Run the following command to stop the database and the listener:

Run the following command to stop and start the listener and database:

Run the following command to start the listener and database:

Run the following command to stop the database and the listener:

Run the following command to stop and start the listener and database:

Shutting Down and Starting Up Using SQL*Plus

You can shut down and start the database using SQL*Plus.

To shutdown the database, login to the oracle user with its environment variables set for access to the XE database, and issue the following SQL*Plus command:

To start the database, issue the commands:

Oracle Database 2 Day DBA for general information about managing a database

Oracle Multitenant Administration Guide for more information about shutting down and starting a PDB

Automating Shutdown and Startup

Oracle recommends that you configure the system to automatically start Oracle Database when the system starts, and to automatically shut it down when the system shuts down. Automating database shutdown guards against incorrect database shutdown.

Источник

Читайте также:  Рабочий стол для линукс ubuntu
Оцените статью