Centos6 Connect WiFi

// 安装 wireless tools
yum install wireless-tools dkms pciutils lsusb // 使用wlan命令检查无线网卡
# iwconfig // 安装 wpa supplicant
# yum install wpa_supplicant
# service wpa_supplicant status
# service wpa_supplicant reload // 编辑文件 /etc/wpa_supplicant/wpa_supplicant.conf
# vi /etc/wpa_supplicant/wpa_supplicant.conf // 编辑文件 /etc/sysconfig/network-scripts/ifcfg-wlan0
# vi /etc/sysconfig/network-scripts/ifcfg-wlan0 // 启用无线网卡wlan0
# ifconfig wlan0 up // 扫描无线网络,如果有用手机热点,建议将热点改为英文名字,避免乱码的问题
# iwlist wlan0 scan // 连接手机的WIFI热点小米
# iwconfig wlan0 essid "xiaomi" // 通过DHCP方式自动获取IP
# dhclient wlan0 // 查看wlan0配置状态
# iwconfig wlan0 // 查看路由状态
# netstat -nr // 测试网络连通性
# ping www.baidu.com
// 编辑文件 /etc/wpa_supplicant/my_wpa_supplicant.conf
# cat /etc/wpa_supplicant/my_wpa_supplicant.conf
ctrl_interface=/var/run/my_wpa_supplicant
ctrl_interface_group=wheel # // 编辑文件 /etc/sysconfig/network-scripts/ifcfg-wlan0
# cat /etc/sysconfig/network-scripts/ifcfg-wlan0
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=dhcp
# // 连接wlan0到网络,并以daemon方式运行。备注:-B Background在后台以daemon 运行,-i interface -c 配置文件
# wpa_supplicant -B -i wlan0 -c /etc/my_wpa_supplicant.conf // 通过DHCP方式自动获取IP
# dhclient wlan0

关闭防火墙,永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off

关闭防火墙,即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop

清空防火墙规则
# iptables -F
# iptables -X
# /etc/init.d/iptables save
# /etc/init.d/iptables status
# /etc/init.d/iptables reload

设置IP转发
# sed -i '/net.ipv4.ip_forward/s/0/1/' /etc/sysctl.conf
# sysctl -p

关闭SELINUX
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
# setenforce 0
# reboot

查询TCP连接情况:
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

查询端口占用情况
netstat -anp | grep portno (例如:netstat –apn | grep 80)

=============== End

Centos6 Connect WiFi的更多相关文章

  1. wpa_cli 连接 wifi

    转自:http://hi.baidu.com/yyangjjun/item/9dfe8e175439fc7a1009b5ba   1: run wpa_supplicant first use the ...

  2. 【移动开发】WIFI热点通信(一)

    之前调查过Android中WIFI模块的使用,也写过两篇学习总结的文章(http://smallwoniu.blog.51cto.com/3911954/1334951),后来发现DEMO里面还是有许 ...

  3. 3-51单片机WIFI学习(开发板8266底层源码介绍)

    上一篇链接  http://www.cnblogs.com/yangfengwu/p/8743502.html 直接上源码:注意源码有两部分,第一部分是一开始的时候写在模块内部的,另一部分是存在手机内 ...

  4. ESP8266串口和MQTT服务器消息互传(版本一) 单纯透传+保存WIFI账号信息

    目标 制作一个ESP8266串口和MQTT相互透传的小WIFI,可用手机修改其连接的路由器,由此该模块可以任意加载到各种串口传输的单片机上,完成硬件到云端的传输. 1 实物图 2 MQTT网页测试客户 ...

  5. wpa_cli 连接 wifi(转)

    wpa_cli 连接 wifi 转自:http://hi.baidu.com/yyangjjun/item/9dfe8e175439fc7a1009b5ba   1: run wpa_supplica ...

  6. [uiautomator篇][11]wifi

    package com.softwinner.network.wifi; import android.content.Context; import android.content.Intent; ...

  7. wpa_supplicant软件架构分析

    wpa_supplicant软件架构分析 1. 启动命令 wpa supplicant 在启动时,启动命令可以带有很多参数,目前我们的启动命令如下: wpa_supplicant /system/bi ...

  8. Android判断网络是否已经连接

    // check all network connect, WIFI or mobile public static boolean isNetworkAvailable(final Context ...

  9. wpa_cli调试工具的使用

    1: run wpa_supplicant first use the following command: wpa_supplicant -Dwext -iwlan0 -C/data/system/ ...

随机推荐

  1. Oracle 查询表注释以及字段注释

    Oracle 查询表注释以及字段注释 --表字段信息 select * from all_tab_columns a where a.TABLE_NAME='T_X27_USER'; --表注释信息 ...

  2. 小D课堂 - 零基础入门SpringBoot2.X到实战_第7节 SpringBoot常用Starter介绍和整合模板引擎Freemaker、thymeleaf_28..SpringBoot Starter讲解

    笔记 1.SpringBoot Starter讲解     简介:介绍什么是SpringBoot Starter和主要作用 1.官网地址:https://docs.spring.io/spring-b ...

  3. Python去除文件中的空格、Tab键和回车

    def stripFile(oldFile, newFile): '''remove the space or Tab or enter in a file, and output a new fil ...

  4. Python3基础 九九乘法表

             Python : 3.7.3          OS : Ubuntu 18.04.2 LTS         IDE : pycharm-community-2019.1.3    ...

  5. Python 线程,with的作用(自动获取和释放锁Lock)

    Python 线程,with的作用(自动获取和释放锁Lock) import threading import time num= #全局变量多个线程可以读写,传递数据 mutex=threading ...

  6. linux中导入sql文件

    在linux中导入sql文件的方法分享(使用命令行转移mysql数据库) 因导出sql文件 在你原来的网站服务商处利用phpmyadmin导出数据库为sql文件,这个步骤大家都会,不赘述. 上传sql ...

  7. 【Redis】Redis 主从模式搭建

    主从模式介绍 Redis虽然读取写入的速度都特别快,但是也会产生读压力特别大的情况.为了分担读压力,Redis支持主从复制,Redis的主从结构可以采用一主多从或者级联结构,Redis主从复制可以根据 ...

  8. ELK之Kibana的可视化监控报警插件sentinl的配置

    参考:https://www.bbsmax.com/A/gGdXbgXmJ4/ https://www.deathearth.com/333.html  https://www.cnblogs.com ...

  9. Python常见的异常

    Python中常见的异常如表所示. exception的更多用法: 1.通常else 语句只有在没有异常的情况下才会被执行 try: aa = "异常测试:" print(aa)e ...

  10. logstash 6.6.0 读取nginx日志 插入到elasticsearch中

    logstash.conf input { # For detail config for log4j as input, # See: https://www.elastic.co/guide/en ...