linux常用配置

2021-09-27 07:22:39 字數 3814 閱讀 9991

[root@localhost ~]

# lshw -c network

*-network

description: ethernet inte***ce

product: 82545em gigabit ethernet controller (copper)

vendor: intel corporation

physical id: 1

bus info: pci@0000:02:01.0

logical name: ens33

version: 01

serial: 00:0c:29:dc:4c:d3

size: 1gbit/s

capacity: 1gbit/s

width: 64 bits

clock: 66mhz

capabilities: pm pcix bus_master cap_list rom ethernet physical logical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation

configuration: autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.21-k8-napi duplex=full ip=192.168.236.137 latency=0 link=yes mingnt=255 multicast=yes port=twisted pair speed=1gbit/s

resources: irq:19 memory:fd5c0000-fd5dffff memory:fdff0000-fdffffff ioport:2000(size=64) memory:fd500000-fd50ffff

```shell

logical name是網絡卡的名稱,比如eth0

# 檢查網口,點網口的燈

```shell

[root@localhost ~]

# ethtool -p ens33 20

redhat系的網絡卡配置放在/etc/sysconfig/network-scripts目錄下,下面是乙個網絡卡配置的示例:

[root@localhost ~]

# less /etc/sysconfig/network-scripts/ifcfg-ens33

type=ethernet

proxy_method=none

browser_only=no

bootproto=dhcp

defroute=yes

ipv4_failure_fatal=no

ipv6init=yes

ipv6_autoconf=yes

ipv6_defroute=yes

ipv6_failure_fatal=no

ipv6_addr_gen_mode=stable-privacy

name=ens33

uuid=eceb3be3-d693-426a-86db-d1d593a0388c

device=ens33

onboot=yes

ipv6_privacy=no

debian系的網絡卡配配置存在/etc/network/inte***ces檔案裡面,無論有多少塊網絡卡,統統寫在這乙個檔案裡,下面是乙個網絡卡配置的示例:

auto lo 

iface lo inet loopback

# the primary network inte***ce

auto eth0

iface eth0 inet static

address 192.168.0.42

network 192.168.0.0

netmask 255.255.255.0

broadcast 192.168.0.255

gateway 192.168.0.1

# the secondary network inte***ce use dhcp

auto eth1

iface eth1 inet dhcp

檢查路由:

[root@localhost ~]

# netstat -rn

kernel ip routing table

destination gateway genmask flags mss window irtt iface

0.0.0.0 192.168.8.254 0.0.0.0 ug 0 0 0 enp13s0f0

192.168.0.0 192.168.0.1 255.255.255.0 u 0 0 0 enp13s0f2

192.168.8.0 192.168.8.254 255.255.255.0 u 0 0 0 enp13s0f0

刪除預設路由:

route delete -net 0.0.0.0/0 gw 192.168.8.254 enp13s0f0
新增預設路由:

route add -net 0.0.0.0/0 gw 192.168.0.1 enp13s0f2
設定dns

[root@localhost ~]

# less /etc/resolv.conf

# generated by networkmanager

search localdomain

nameserver 192.168.236.2

service networking restart

或者ifdown eth0

ifup eth0

[root@localhost ~]

# systemctl restart networkmanager.service

sudo

mount ./dm7_setup_rh6_64.iso /media/cdrom

sudo

umount /media/cdrom

systemctl status ufw
kylin@agent4:/var/www/html$ sudo

netstat -nltp |

grep 8000

tcp6 0 0 :::8000 :::* listen 4355/node

systemctl list-unit-files --type=service|

grep enabled

禁用掉該服務

sudo systemctl disable apache2.service
# du -sh *

80k data

8.0k dnode

20k mgmt

2.0m mnode

28k tsdb

432k vnode

264m vnode_bak

Linux 常用配置

使用者管理 建立普通使用者 useradd hadoop 給使用者設定密碼 passwd hadoop 建立組 groupadd monster 建立乙個使用者 fox,並放入到 monster組中 useradd g monster fox 修改檔案所在的組 chgrp 組名 檔名 給普通使用者h...

Linux常用網路配置

在linux中,如果我們要修改ip位址 更改主機名 配置dns和網域名稱解析等,常會用到下面幾個檔案 etc sysconfig network centos設定主機名和網路配置 etc sysconfig network scripts ifcfg eth0 針對特定的網絡卡進行設定 etc re...

linux常用網路配置

linux系統 修改linux的主機名 1,hostname xx 2,修改 etc sysconfig network中的hostname 3,修改 etc hosts 二 centos 修改閘道器 修改對應網絡卡的閘道器的配置檔案 root centos vi etc sysconfig net...