以太坊编程使用ubuntu
⑴ ubuntu检测不到以太网卡eth0……在终端使用命令建立连接时,第一步检测以太网卡就无法通过,
可以看看这个文章:
http://www.yyearth.com/article/14-04/network.html
⑵ ubuntu 装ntop 我需要配置eth0和eth1两块网卡,如何进行设置
# ./ntop -P /var/ntop/ -i eth0 -u ntop 启动服务
试一下吧
⑶ Linux下设置 IP,我看很多人都说用vi /etc/sysconfig/network-scripts/ifcfg-eth0
如果你确定你的/etc/下没有sysconfig文件夹,那么你应该装的不是rh linux,有可能是其他版本的linux,例如ubuntu。
那你看看/etc/下面有没有一个networks目录。看看有没有一个文件叫做interfaces.如果有就在这里面配置。配置如下,假设你只有一块网卡。
auto eth0
address 192.168.1.123
netmask 255.255.255.0
gateway 192.168.1.1
保存退出。重启服务,执行: /etc/init.d/networking restart
⑷ 以太坊编程语言Serpent与Python的区别,有什么优点
mps()函数执行和mp()函数相同的序列化。取代接受流对象并将序列化后的数据保存到磁盘文件,这个函数简单的返回序列化的数据。
loads()函数执行和load()函数一样的反序列化。取代接受一个流对象并去文件读取序列化后的数据,它接受包含序列化后的数据的str对象, 直接返回的对象。
⑸ ubuntu 自动以太网 eth0 问题 为什么网络连接只能用自动以太网 不能用eth0 啊 怎么设置
描述不是很清楚额。
没明白你的目的。
eth0是设备名。eh0连接的是以太网络。
如果你的意思说是连接不了网络的话。
要看你家的网络状况而定
是ppoe还是isp给你的固定ip地址。
如果ppoe的话可以点击链接的哪个地方对链接设备更改配置,需要输入安装时候你设置的密码。然后添加ppoe
⑹ ubuntu怎么设置以太网
Ubuntu
$sudo vi /etc/network/interfaces
iface eth0 inet dhcp (自动获取ip)
auto eth0
iface eth0 inet static
address 192.168.0.22 ip地址
netmask 255.255.255.0 子网掩码
gateway 192.168.0.1 网关
$ sudo /etc/init.d/networking restart 重启网络
dns 添加
sudo vim /etc/resolv.conf
nameserver 8.8.8.8
⑺ ubuntu14.04怎么做个网关
案例. 仅供参考.
在CentOS 6, Ubuntu 14.04, Debian7, CentOS 5, RHEL 5/6都可用.
以下是我的具体案例, 请依据你的实际情况修改.
网络拓扑:
Gateway / NAT server,
eth0 --- public internet 59.72.122.110 netmask 255.255.255.0 gateway 59.72.122.254
eth1 --- private network 192.9.200.200 netmask 255.255.255.0 gateway 192.9.200.254
eth1 链接一个私有的交换机或者集线器, 其他的机器, 包括无线路由器, 链接该交换机或者集线器, 192.9.200.254是eth1所链接的交换机的网关地址.
在Gateway / NAT server上设定.
先设定Gateway / NAT server上的两个网络.
#### The private network runs on interface eth1
#### The public network runs on interface eth0
EXTIF="eth0"
INIF="eth1"
export INIF EXTIF
### shutdown all interfaces.
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth2 down
ifconfig eth3 down
### public
ifconfig $EXTIF hw ether 00:11:B0:19:89:64
ifconfig $EXTIF 59.72.122.110 netmask 255.255.255.0
### private
ifconfig $INIF 192.9.200.200 netmask 255.255.255.0
### Bring up the two interfaces
ifconfig $EXTIF up
ifconfig $INIF up
### configure the route table
route add -net 192.9.0.0 netmask 255.255.0.0 gw 192.9.200.254 dev $INIF
route add default gw 59.72.122.254 dev $EXTIF
####EOF
请酌情修改.
####BOF
#!/bin/bash
EXTIF="eth0"
INIF="eth1"
INNET="192.9.200.0/24"
export INIF EXTIF INNET
### For NAT Gateway
# Starting NAT Server
echo "1" > /proc/sys/net/ipv4/ip_forward
### Flush the original rules
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
/sbin/iptables -F -t nat
/sbin/iptables -X -t nat
/sbin/iptables -Z -t nat
# Set Default Rules
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -t nat -P PREROUTING ACCEPT
/sbin/iptables -t nat -P POSTROUTING ACCEPT
/sbin/iptables -t nat -P OUTPUT ACCEPT
### No extra control
### All Forward from the private INNET is allowed.
### Accept all the Forward request form $INIF
/sbin/iptables -A FORWARD -i $INIF -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
/sbin/iptables -t nat -A POSTROUTING -o $INIF -j MASQUERADE
### Forward chain
### Allow vpn client to access private network
/sbin/iptables -A FORWARD -i ppp+ -o $INIF -j ACCEPT
/sbin/iptables -A FORWARD -i $INIF -o ppp+ -j ACCEPT
### Allow vpn client to access pub network
/sbin/iptables -A FORWARD -i ppp+ -o $EXTIF -j ACCEPT
/sbin/iptables -A FORWARD -i $EXTIF -o ppp+ -j ACCEPT
###
# the following two lines Enable iptables work in High Efficiency
/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
### EOF####
抱歉, 我不会使用ipbtale指令, 就写了这个简单的脚本, 开机自己运行.
如果你没有vpn服务, 请忽略ppp+相关的设定.
如果你有其他安全要求, 请修改INPUT为DROP, 然后逐条开放.
客户机上的设定:
IP和eth1保持一个地址段, 但是记得网关指定为Gateway /NAT server上的eth1的IP地址.
无线路由器上, 设定WLAN端口IP后, 指定网关是192.9.200.200, 在LAN上开启DHCP.
其他台式机, 如何开启DHCP, 我自己没有处理, 我想你需要在Gateway /NAT server上开起DHCP服务就可以了.
但是记得要推送网关为你的eth1的IP地址.
⑻ linux嵌入式系统下编程修改ip mac地址,c语言程序,具体操作类似 ifconfig eth down ifconfig eth0 Up
#include <stdlib.h>int system(const char *string);例:在~/myprogram/目录下有shell脚本test.sh,内容为#!bin/bash#test.shecho $HOME在该目录下新建一个c文件systemtest.c,内容为:#include<stdlib.h>main(){
system("~/myprogram/test.sh");}执行结果如下:xiakeyou@ubuntu:~/myprogram$ gcc systemtest.c -o
systemtestxiakeyou@ubuntu:~/myprogram$ ./systemtest/home/d/e/xiakeyouxiakeyou@ubuntu:~/myprogram$2)popen(char *command,char *type)执行过程:popen()会调用fork()产生子进程,然后从子进程中调用/bin/sh
-c来执行参数command的指令。参数
type可使用“r”代表读取,“w”代表写入。依照此type值,popen()会建立管道连到子进程的标准输出设备或标准输入设备,然后返回一个文件
指针。随后进程便可利用此文件指针来读取子进程的输出设备或是写入到子进程的标准输入设备中。此外,所有使用文件指针(FILE*)操作的函数也都可以使
用,除了fclose()以外。返回值:若成功则返回文件指针,否则返回NULL,错误原因存于errno中。
注意:在编写具SUID/SGID权限的程序时请尽量避免使用popen(),popen()会继承环境变量,通过环境变量可能会造成系统安全的问题。例:C程序popentest.c内容如下:#include<stdio.h>main(){FILE * fp;charbuffer[80];fp=popen(“~/myprogram/test.sh”,”r”);fgets(buffer,sizeof(buffer),fp);printf(“%s”,buffer);pclose(fp);}执行结果如下:xiakeyou@ubuntu:~/myprogram$ vim popentest.cxiakeyou@ubuntu:~/myprogram$ gcc popentest.c -o popentestxiakeyou@ubuntu:~/myprogram$ ./popentest/home/d/e/xiakeyouxiakeyou@ubuntu:~/myprogram$
只是偶能力可能有点有限,没有太看懂。直接用system()倒是脚本可是执行,只是返回值却是一塌糊涂,试了多次也没有找到什么规律。不免又看了一下上面的那篇博文,得到一些启发,可以这样来实现:先将脚本的返回值利用 echo > XXXXX 输出到一个本地文件中当需要这个返回值是,可是通过C语言的文件操作函数来直接从文件中读取后来一想,这应该就是上文中POPEN的实现方法!C程序调用shell脚本共有三种法子 :system()、popen()、exec系列函数 system()
不用你自己去产生进程,它已经封装了,直接加入自己的命令exec 需要你自己 fork 进程,然后exec 自己的命令popen() 也可以实现执行你的命令,比system 开销小1)system(shell命令或shell脚本路径);system()会调用fork()产生 子历程,由子历程来调用/bin/sh-c string来履行
参数string字符串所代表的命令,此命令履行 完后随即返回原调用的历程。在调用system()期间SIGCHLD
信号会被暂时搁置,SIGINT和SIGQUIT 信号则会被漠视 。
返回值:如果system()在调用/bin/sh时失败则返回127,其他失败原因返回-1。若参数string为空指针(NULL),则返回非零值。
如果 system()调用成功 则最后会返回履行
shell命令后的返回值,但是此返回值也有可能为system()调用/bin/sh失败所返回的127,因 此最好能再反省 errno
来确认履行 成功 。system命令以其简略 高效的作用得到很很广泛 的利用 ,下面是一个例子例:在~/test/目录下有shell脚本test.sh,内容为#!bin/bash#test.shecho hello在同层目录下新建一个c文件system_test.c,内容为:#include<stdlib.h>int main(){system("~/test/test.sh");}履行 效果 如下:[root@localhost test]$gcc system_test.c -o system_test[root@localhost test]$./system_testhello[root@localhost test]$2)popen(char *command,char *type)popen()会调用fork()产生 子历程,然后从子历程中调用/bin/sh -c来履行
参数command的指令。参数type可应用 “r”代表读取,“w”代表写入。遵循此type值,popen()会建立
管道连到子历程的标准 输出设备 或标准 输入设备 ,然后返回一个文件指针。随后历程便可利用 此文件指针来读取子历程的输出设备
或是写入到子历程的标准 输入设备 中。此外,所有应用 文 件指针(FILE*)操作的函数也都可以应用
,除了fclose()以外。返回值:若成功 则返回文件指针,否则返回NULL,差错
原因存于errno中。注意:在编写具SUID/SGID权限的程序时请尽量避免应用popen(),popen()会继承环境变量,通过环境变量可能会造成系统安全的问题。例:C程序popentest.c内容如下:#include<stdio.h>main{FILE * fp;charbuffer[80];fp=popen(“~/myprogram/test.sh”,”r”);fgets(buffer,sizeof(buffer),fp);printf(“%s”,buffer);pclose(fp);}履行 效果 如下:[root@localhost test]$ vim popentest.c[root@localhost test]$ gcc popentest.c -o popentest[root@localhost test]$ ./popentest/root/test[root@localhost test]$