Wie konfiguriere ich Netzwerkprofile in Centos?

1753
Leven

Ich versuche zwei Netzwerkprofile in Centos einzurichten. Einer für zu Hause, einer für die Arbeit. Das Basisprofil hat eine feste IP-Adresse, ein festes Gateway und DNS-Serveradressen. Das Arbeitsprofil hängt von DHCP ab.

Ich habe in / etc / sysconfig / networking / profiles ein "home" - und ein "work" -Verzeichnis erstellt. Jedes enthält die folgenden Dateien mit der richtigen Konfiguration:

> -rw-r--r-- 2 root root 422 Apr 17 20:17 hosts > -rw-r--r-- 5 root root 223 Apr 17 20:18 ifcfg-eth0 > -rw-r--r-- 1 root root 101 Apr 17 20:17 network > -rw-r--r-- 2 root root 73 Apr 17 20:18 resolv.conf 

Es gab bereits ein Standardprofil, das die gleichen Dateien enthält.

Ich gab diese Befehle aus:

system-config-network-cmd --profile work --activate service network restart 

Ich habe erwartet, dass diese Dateien aus dem profiles/workVerzeichnis nach /etc/sysconfig/und kopiert werden /etc/sysconfig/networking-scripts. Und die meisten Dateien werden kopiert, außer für ifcfg-eth0.

Seltsamerweise scheinen die Dateien bei der Ausgabe mit den aktuellen Einstellungen überschrieben zu werden system-config-network-cmd. Die anderen Dateien werden ebenfalls berührt, aber der Inhalt bleibt erhalten.

Das System ist Centos 5.7, das auf einem virtuellen PC innerhalb einer Windows 7-Maschine ausgeführt wird. Hier ist die Ausgabe für ifconfig:

# ifconfig eth0 Link encap:Ethernet HWaddr 00:03:FF:6F:2E:AB inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::203:ffff:fe6f:2eab/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4199761 errors:7 dropped:0 overruns:0 frame:0 TX packets:1733750 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2316624688 (2.1 GiB) TX bytes:415533386 (396.2 MiB) Interrupt:9 

Kann jemand sagen, was mir hier fehlt?

2

1 Antwort auf die Frage

0
Manoj Agarwal

To access a virtual machine configured within IP range assigned from router - 192.168.0.1 from home network - 192.168.1.0, we can use the following procedure:

Inside your virtual machine, type ‘neat’ command which is used to configure network adapters. As of now, we have configured two adapters – loopback and one with IP 192.168.0.30 for example. If we have to use this virtual machine on another network, then we need to add another adapter using ‘New’ option that we get with neat. We need to add a new network adapter and assign IP in the range of host network. For example, the IP for this network adapter should be 192.168.1.5 (the permissible range in your network), 255.255.255.0 (subnet mask), 192.168.1.1 (default gateway). Save these settings. In /etc/resolv.conf file you need to add an entry – nameserver 192.168.1.1. In /etc/hosts file, add another entry for this new IP ie. 192.168.1.5 example () and restart network service.

Ping windows machine from linux and linux machine from windows, you should be able to ping it. NO CHANGE is needed in windows host file, if you wish to access your virtual machine with IP address. But if you want to use hostname, then you need to add another entry in c:/windows/system32/drivers/etc/hosts files – 192.168.2.5 example, considering your machine hostname is example, as hosts file is used for name resolution.

So you can work in bridged environment without changing any IP at home and office.